Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! module: remove bogus assertion in CJS entrypoint handling with…
… --import
  • Loading branch information
joyeecheung committed Aug 28, 2024
commit bc43b1aaa2172f0db22614e4bb4fb986e6ebf0c9
38 changes: 26 additions & 12 deletions test/es-module/test-require-module-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

require('../common');
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
const fixtures = require('../common/fixtures');

const { fixturesDir } = require('../common/fixtures');
const stderr = /ExperimentalWarning: Support for loading ES Module in require/;

function testPreload(preloadFlag) {
Expand All @@ -14,9 +13,12 @@ function testPreload(preloadFlag) {
[
'--experimental-require-module',
preloadFlag,
fixtures.path('es-module-loaders/module-named-exports.mjs'),
fixtures.path('printA.js'),
'./es-module-loaders/module-named-exports.mjs',
'./printA.js',
],
{
cwd: fixturesDir
},
{
stdout: 'A',
stderr,
Expand All @@ -32,9 +34,12 @@ function testPreload(preloadFlag) {
[
'--experimental-require-module',
preloadFlag,
fixtures.path('es-modules/import-esm.mjs'),
fixtures.path('printA.js'),
'./es-modules/import-esm.mjs',
'./printA.js',
],
{
cwd: fixturesDir
},
{
stderr,
stdout: /^world\s+A$/,
Expand All @@ -50,9 +55,12 @@ function testPreload(preloadFlag) {
[
'--experimental-require-module',
preloadFlag,
fixtures.path('es-modules/cjs-exports.mjs'),
fixtures.path('printA.js'),
'./es-modules/cjs-exports.mjs',
'./printA.js',
],
{
cwd: fixturesDir
},
{
stdout: /^ok\s+A$/,
stderr,
Expand All @@ -70,9 +78,12 @@ function testPreload(preloadFlag) {
[
'--experimental-require-module',
preloadFlag,
fixtures.path('es-modules/require-cjs.mjs'),
fixtures.path('printA.js'),
'./es-modules/require-cjs.mjs',
'./printA.js',
],
{
cwd: fixturesDir
},
{
stdout: /^world\s+A$/,
stderr,
Expand All @@ -93,9 +104,12 @@ testPreload('--import');
[
'--experimental-require-module',
'--require',
fixtures.path('es-modules/package-type-module'),
fixtures.path('printA.js'),
'./es-modules/package-type-module',
'./printA.js',
],
{
cwd: fixturesDir
},
{
stdout: /^package-type-module\s+A$/,
stderr,
Expand Down