diff options
author | Myles Borins <mylesborins@google.com> | 2019-11-27 01:54:23 -0500 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2019-12-04 13:21:41 -0800 |
commit | ee953d813be1fb19930e0e64196c0aa33699b133 (patch) | |
tree | 2b11d0315bcbb33ee26ad333a798ff012da696fa /test/es-module | |
parent | 12254ce242c30d403b523ad9adb60a0280080957 (diff) | |
download | android-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.tar.gz android-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.tar.bz2 android-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.zip |
esm: make specifier flag clearly experimental
`--es-module-specifier-resolution` is the only flagged portion of the
ESM implementation that does not have the word experimental in the flag
name. This commit changes the flag to:
`--experimental-specifier-resolution`
`--es-module-specifier-resolution` remains as an alias for backwards
compatibility but it is no longer documented.
PR-URL: https://github.com/nodejs/node/pull/30678
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Diffstat (limited to 'test/es-module')
-rw-r--r-- | test/es-module/test-esm-specifiers-both-flags.mjs | 16 | ||||
-rw-r--r-- | test/es-module/test-esm-specifiers-legacy-flag.mjs | 18 | ||||
-rw-r--r-- | test/es-module/test-esm-specifiers.mjs | 2 |
3 files changed, 35 insertions, 1 deletions
diff --git a/test/es-module/test-esm-specifiers-both-flags.mjs b/test/es-module/test-esm-specifiers-both-flags.mjs new file mode 100644 index 0000000000..fc5c7fcd0e --- /dev/null +++ b/test/es-module/test-esm-specifiers-both-flags.mjs @@ -0,0 +1,16 @@ +import { mustCall } from '../common/index.mjs'; +import { exec } from 'child_process'; +import assert from 'assert'; + +const expectedError = + 'cannot use --es-module-specifier-resolution ' + + 'and --experimental-specifier-resolution at the same time'; + +const flags = '--es-module-specifier-resolution=node ' + + '--experimental-specifier-resolution=node'; + +exec(`${process.execPath} ${flags}`, { + timeout: 300 +}, mustCall((error) => { + assert(error.message.includes(expectedError)); +})); diff --git a/test/es-module/test-esm-specifiers-legacy-flag.mjs b/test/es-module/test-esm-specifiers-legacy-flag.mjs new file mode 100644 index 0000000000..fcf0c915b6 --- /dev/null +++ b/test/es-module/test-esm-specifiers-legacy-flag.mjs @@ -0,0 +1,18 @@ +// Flags: --es-module-specifier-resolution=node +import '../common/index.mjs'; +import assert from 'assert'; + +// commonJS index.js +import commonjs from '../fixtures/es-module-specifiers/package-type-commonjs'; +// esm index.js +import module from '../fixtures/es-module-specifiers/package-type-module'; +// Notice the trailing slash +import success, { explicit, implicit, implicitModule } + from '../fixtures/es-module-specifiers/'; + +assert.strictEqual(commonjs, 'commonjs'); +assert.strictEqual(module, 'module'); +assert.strictEqual(success, 'success'); +assert.strictEqual(explicit, 'esm'); +assert.strictEqual(implicit, 'cjs'); +assert.strictEqual(implicitModule, 'cjs'); diff --git a/test/es-module/test-esm-specifiers.mjs b/test/es-module/test-esm-specifiers.mjs index fdf9e5b25e..5e436f21b7 100644 --- a/test/es-module/test-esm-specifiers.mjs +++ b/test/es-module/test-esm-specifiers.mjs @@ -1,4 +1,4 @@ -// Flags: --es-module-specifier-resolution=node +// Flags: --experimental-specifier-resolution=node import { mustNotCall } from '../common/index.mjs'; import assert from 'assert'; import path from 'path'; |