From 77c69f51a3e8ade480f4aaf109f3a9003b205873 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 5 Dec 2019 00:11:04 -0500 Subject: [PATCH] module: fixup lint and test regressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/30802 Reviewed-By: Rich Trott Reviewed-By: João Reis Reviewed-By: Matteo Collina --- test/es-module/test-cjs-esm-warn.js | 11 ++++------- test/es-module/test-esm-specifiers-both-flags.mjs | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/es-module/test-cjs-esm-warn.js b/test/es-module/test-cjs-esm-warn.js index b800a47d0515d5..ddeda72fc84b41 100644 --- a/test/es-module/test-cjs-esm-warn.js +++ b/test/es-module/test-cjs-esm-warn.js @@ -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} ` + @@ -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')); })); diff --git a/test/es-module/test-esm-specifiers-both-flags.mjs b/test/es-module/test-esm-specifiers-both-flags.mjs index 42fb1cb68974a9..5cdeed0c82a888 100644 --- a/test/es-module/test-esm-specifiers-both-flags.mjs +++ b/test/es-module/test-esm-specifiers-both-flags.mjs @@ -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)); }));