Skip to content

Commit

Permalink
boa: skip the esm tests for node >= 14.5.0 (#347)
Browse files Browse the repository at this point in the history
See nodejs/node#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: nodejs/node#34093
  • Loading branch information
yorkie committed Jul 15, 2020
1 parent 36bb8dc commit d6e4312
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/boa/.eslintrc.js
Expand Up @@ -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",
Expand Down
14 changes: 11 additions & 3 deletions packages/boa/tests/es-module-loaders/common.js
Expand Up @@ -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);
}

Expand Down

0 comments on commit d6e4312

Please sign in to comment.