Skip to content

Commit 4dc2791

Browse files
legendecasaduh95
authored andcommitted
test: add repl preview timeout test
PR-URL: #55484 Refs: v8/v8@f915fa4 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent df2f1ad commit 4dc2791

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
constcommon=require('../common');
4+
constArrayStream=require('../common/arraystream');
5+
constassert=require('assert');
6+
constrepl=require('repl');
7+
8+
common.skipIfInspectorDisabled();
9+
10+
constinputStream=newArrayStream();
11+
constoutputStream=newArrayStream();
12+
repl.start({
13+
input: inputStream,
14+
output: outputStream,
15+
useGlobal: false,
16+
terminal: true,
17+
useColors: true
18+
});
19+
20+
letoutput='';
21+
outputStream.write=(chunk)=>output+=chunk;
22+
23+
// Input without '\n' triggering actual run.
24+
constinput='while (true){}';
25+
inputStream.emit('data',input);
26+
// No preview available when timed out.
27+
assert.strictEqual(output,input);

0 commit comments

Comments
(0)