node/test/parallel/test-repl-dynamic-import.js
Bradley Farias ca26eae966 repl: give repl entries unique names
This is a workaround for the REPL for a problem when multiple of the
entries have the same source text

Fixes: https://github.com/nodejs/node/issues/1337
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=10284

PR-URL: https://github.com/nodejs/node/pull/34372
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-08-03 17:38:55 -05:00

21 lines
582 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const child_process = require('child_process');
const child = child_process.spawn(process.execPath, [
'--interactive',
'--expose-gc'
], {
stdio: 'pipe'
});
child.stdin.write('\nimport("fs");\n_.then(gc);\n');
// Wait for concurrent GC to finish
setTimeout(() => {
child.stdin.write('\nimport("fs");\n');
child.stdin.write('\nprocess.exit(0);\n');
}, common.platformTimeout(50));
child.on('exit', (code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
});