Skip to content

Commit 2a2ae8e

Browse files
guybedfordMylesBorins
authored andcommitted
module: fixup lint and test regressions
PR-URL: #30802 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: João Reis <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 9696e9e commit 2a2ae8e

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

test/es-module/test-cjs-esm-warn.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ child.on('close', common.mustCall((code, signal) => {
2626
assert.strictEqual(code, 1);
2727
assert.strictEqual(signal, null);
2828

29-
assert.ok(stderr.indexOf(
29+
assert.ok(stderr.replace(/\r/g, '').includes(
3030
`Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ${required}` +
3131
'\nrequire() of ES modules is not supported.\nrequire() of ' +
3232
`${required} from ${requiring} ` +
@@ -35,10 +35,7 @@ child.on('close', common.mustCall((code, signal) => {
3535
'files in that package scope as ES modules.\nInstead rename ' +
3636
`${basename} to end in .cjs, change the requiring code to use ` +
3737
'import(), or remove "type": "module" from ' +
38-
`${pjson}.\n`) !== -1);
39-
assert.ok(stderr.indexOf(
40-
'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module') !== -1);
41-
42-
assert.strictEqual(
43-
stderr.match(/Must use import to load ES Module/g).length, 1);
38+
`${pjson}.\n`));
39+
assert.ok(stderr.includes(
40+
'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module'));
4441
}));

test/es-module/test-esm-specifiers-both-flags.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const flags = '--experimental-modules ' +
1111
'--es-module-specifier-resolution=node ' +
1212
'--experimental-specifier-resolution=node';
1313

14-
exec(`${process.execPath} ${flags}`, {
15-
timeout: 300
16-
}, mustCall((error) => {
14+
exec(`${process.execPath} ${flags}`, mustCall((error) => {
1715
assert(error.message.includes(expectedError));
1816
}));

0 commit comments

Comments
 (0)