node/test/es-module/test-esm-repl.js
Antoine du Hamel 5f77aebdfb
test: ensure assertions are reachable in test/es-module
PR-URL: https://github.com/nodejs/node/pull/60501
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2025-11-07 09:24:01 +01:00

19 lines
392 B
JavaScript

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