Skip to content

Commit 78fa809

Browse files
committed
test: avoid spawning repl import crash regression test
Signed-off-by: waqar bin zafar <waqarniazi51@gmail.com>
1 parent df02a83 commit 78fa809

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
'use strict';
2-
const common = require('../common');
3-
const child_process = require('child_process');
4-
const assert = require('assert');
2+
require('../common');
3+
const repl = require('repl');
54

65
// Regression test for https://github.com/nodejs/node/issues/63551:
76
// Typing a bare `import` keyword in the REPL must not crash the process.
8-
const proc = child_process.spawn(process.execPath, ['-i']);
9-
proc.on('error', common.mustNotCall());
10-
proc.on('exit', common.mustCall((code) => {
11-
assert.strictEqual(code, 0);
12-
}));
13-
proc.stdin.write('import\n.exit\n');
7+
const replserver = new repl.REPLServer();
8+
9+
replserver.emit('line', 'import');
10+
replserver.emit('line', '.exit');

0 commit comments

Comments
 (0)