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 <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent df2f1ad commit 4dc2791

File tree

1 file changed

+27
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)