mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
a6b030d5ac
PR-URL: https://github.com/nodejs/node/pull/29937 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
28 lines
736 B
JavaScript
28 lines
736 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/package-type-module/noext-esm');
|
|
|
|
// Run a module that does not have extension.
|
|
// This is to ensure that "type": "module" applies to extensionless files.
|
|
|
|
const child = spawn(process.execPath, [
|
|
'--experimental-modules',
|
|
entry
|
|
]);
|
|
|
|
let stdout = '';
|
|
child.stdout.setEncoding('utf8');
|
|
child.stdout.on('data', (data) => {
|
|
stdout += data;
|
|
});
|
|
child.on('close', common.mustCall((code, signal) => {
|
|
assert.strictEqual(code, 0);
|
|
assert.strictEqual(signal, null);
|
|
assert.strictEqual(stdout, 'executed\n');
|
|
}));
|