diff options
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'; |