From d6e4312dcdf969c276f186c93536ebeea2851d5e Mon Sep 17 00:00:00 2001 From: Yorkie Liu Date: Wed, 15 Jul 2020 15:07:52 +0800 Subject: [PATCH] boa: skip the esm tests for node >= 14.5.0 (#347) See https://github.com/nodejs/node/pull/33501 At Node.js 14.5.0, it removes the dynamic module format, so we need to make compatible works for the new usage with esm loader. Node.js Release PR: https://github.com/nodejs/node/pull/34093 --- packages/boa/.eslintrc.js | 2 +- packages/boa/tests/es-module-loaders/common.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/boa/.eslintrc.js b/packages/boa/.eslintrc.js index e73575f1b..ed3ebcc47 100644 --- a/packages/boa/.eslintrc.js +++ b/packages/boa/.eslintrc.js @@ -193,7 +193,7 @@ module.exports = { "no-param-reassign": "error", "no-path-concat": "error", "no-plusplus": "error", - "no-process-env": "error", + "no-process-env": "off", "no-process-exit": "error", "no-proto": "error", "no-restricted-globals": "error", diff --git a/packages/boa/tests/es-module-loaders/common.js b/packages/boa/tests/es-module-loaders/common.js index 12a6bd909..8be69e5fc 100644 --- a/packages/boa/tests/es-module-loaders/common.js +++ b/packages/boa/tests/es-module-loaders/common.js @@ -13,10 +13,18 @@ function getAbsolutePath(relativePath) { const FLAG = '--experimental-loader'; const PATH_ESM_LOADER = getAbsolutePath('../../esm/loader.mjs'); -// See https://github.com/nodejs/node/pull/29796 -if (process.version < 'v12.11.1') { +const [major, minor, patch] = process.version.replace('v', '').split('.'); +if (major <= '12' && minor <= '11' && patch <= '1') { + // See https://github.com/nodejs/node/pull/29796 console.log(`1..0 # Skipped: Current nodejs version: ${ - process.version} does not support \`--experimental-loader\``); + process.version} does not support \`--experimental-loader\`.`); + process.exit(0); +} +if (major >= '14' && minor >= '5') { + // https://github.com/nodejs/node/pull/33501 + // TODO(yorkie): compatible with the new esm hooks. + console.log(`1..0 # Skipped: Current nodejs version ${ + process.version} does not support dynamic module type.`); process.exit(0); }