Skip to content

Commit a7ec78f

Browse files
guybedfordtargos
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 bd2f127 commit a7ec78f

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

lib/internal/modules/cjs/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ Module.prototype._compile = function(content, filename) {
11121112
} catch {
11131113
// We only expect this codepath to be reached in the case of a
11141114
// preloaded module (it will fail earlier with the main entry)
1115-
assert(Array.isArray(getOptionValue('--require')));
1115+
assert(ArrayIsArray(getOptionValue('--require')));
11161116
}
11171117
} else {
11181118
resolvedArgv = 'repl';

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
@@ -9,8 +9,6 @@ const expectedError =
99
const flags = '--es-module-specifier-resolution=node ' +
1010
'--experimental-specifier-resolution=node';
1111

12-
exec(`${process.execPath} ${flags}`, {
13-
timeout: 300
14-
}, mustCall((error) => {
12+
exec(`${process.execPath} ${flags}`, mustCall((error) => {
1513
assert(error.message.includes(expectedError));
1614
}));

0 commit comments

Comments
 (0)