mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
883e1cd21d
PR-URL: https://github.com/nodejs/node/pull/21350 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
28 lines
784 B
JavaScript
28 lines
784 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const { spawn } = require('child_process');
|
|
const assert = require('assert');
|
|
|
|
const entry = fixtures.path('/es-modules/cjs.js');
|
|
|
|
const child = spawn(process.execPath, ['--experimental-modules', entry]);
|
|
let experimentalWarning = false;
|
|
let validatedExecution = false;
|
|
child.stderr.on('data', (data) => {
|
|
if (!experimentalWarning) {
|
|
experimentalWarning = true;
|
|
return;
|
|
}
|
|
throw new Error(data.toString());
|
|
});
|
|
child.stdout.on('data', (data) => {
|
|
assert.strictEqual(data.toString(), 'executed\n');
|
|
validatedExecution = true;
|
|
});
|
|
child.on('close', common.mustCall((code, stdout) => {
|
|
assert.strictEqual(validatedExecution, true);
|
|
assert.strictEqual(code, 0);
|
|
}));
|