Skip to content

Commit

Permalink
module: fixup lint and test regressions
Browse files Browse the repository at this point in the history
PR-URL: #30802
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
guybedford authored and MylesBorins committed Jan 12, 2020
1 parent 9696e9e commit 2a2ae8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 4 additions & 7 deletions test/es-module/test-cjs-esm-warn.js
Expand Up @@ -26,7 +26,7 @@ child.on('close', common.mustCall((code, signal) => {
assert.strictEqual(code, 1);
assert.strictEqual(signal, null);

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

assert.strictEqual(
stderr.match(/Must use import to load ES Module/g).length, 1);
`${pjson}.\n`));
assert.ok(stderr.includes(
'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module'));
}));
4 changes: 1 addition & 3 deletions test/es-module/test-esm-specifiers-both-flags.mjs
Expand Up @@ -11,8 +11,6 @@ const flags = '--experimental-modules ' +
'--es-module-specifier-resolution=node ' +
'--experimental-specifier-resolution=node';

exec(`${process.execPath} ${flags}`, {
timeout: 300
}, mustCall((error) => {
exec(`${process.execPath} ${flags}`, mustCall((error) => {
assert(error.message.includes(expectedError));
}));

0 comments on commit 2a2ae8e

Please sign in to comment.