Skip to content

Commit 0d2ccad

Browse files
committed
repl: fix line-queue tests
1 parent 1b8e4c3 commit 0d2ccad

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/parallel/test-repl-line-queue.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
'use strict';
2+
// Flags: --expose-internals --experimental-repl-await
3+
24
require('../common');
35
const ArrayStream = require('../common/arraystream');
46

57
const assert = require('assert');
68
const repl = require('repl');
79

8-
// Flags: --expose-internals --experimental-repl-await
10+
function* expectedLines(lines) {
11+
for (const line of lines) {
12+
yield line;
13+
}
14+
throw new Error('Requested more lines than expected');
15+
}
916

1017
const putIn = new ArrayStream();
1118
repl.start({
@@ -14,11 +21,9 @@ repl.start({
1421
useGlobal: false
1522
});
1623

17-
let expectedIndex = -1;
18-
const expected = ['undefined', '> ', '1', '> '];
19-
24+
const expectedOutput = expectedLines(['undefined\n', '> ', '1\n', '> ']);
2025
putIn.write = function(data) {
21-
assert.strict(data, expected[expectedIndex += 1]);
26+
assert.strictEqual(data, expectedOutput.next().value);
2227
};
2328

2429
putIn.run([

0 commit comments

Comments
 (0)