node/test/es-module/test-esm-repl.js
Bradley Farias cdebd32461 esm: make dynamic import work in the REPL
PR-URL: https://github.com/nodejs/node/pull/29437
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-09-06 11:47:32 -05:00

20 lines
387 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const { spawn } = require('child_process');
const child = spawn(process.execPath, [
'--experimental-modules',
'--interactive'
]);
child.stdin.end(`
import('fs').then(
ns => ns.default === require('fs') ? 0 : 1,
_ => 2
).then(process.exit)
`);
child.on('exit', (code) => {
assert.strictEqual(code, 0);
});