1'use strict'; 2 3const common = require('../common'); 4const fixtures = require('../common/fixtures'); 5const { spawn } = require('child_process'); 6const assert = require('assert'); 7 8const entry = fixtures.path('/es-modules/cjs.js'); 9 10const child = spawn(process.execPath, [entry]); 11child.stderr.setEncoding('utf8'); 12let stdout = ''; 13child.stdout.setEncoding('utf8'); 14child.stdout.on('data', (data) => { 15 stdout += data; 16}); 17child.on('close', common.mustCall((code, signal) => { 18 assert.strictEqual(code, 0); 19 assert.strictEqual(signal, null); 20 assert.strictEqual(stdout, 'executed\n'); 21})); 22