diff options
author | Guy Bedford <guybedford@gmail.com> | 2019-01-16 03:11:10 +0200 |
---|---|---|
committer | Jan Krems <jan.krems@gmail.com> | 2019-07-18 14:54:16 -0700 |
commit | 6df7b6a4f9cb64d298e7fd0691c4d09679872922 (patch) | |
tree | 107d9367d8eab1c72adb33c0c989c0e58cef0418 /test/es-module | |
parent | 9b772250f10da8c5d2ade7c25ccea6ae2601f854 (diff) | |
download | android-node-v8-6df7b6a4f9cb64d298e7fd0691c4d09679872922.tar.gz android-node-v8-6df7b6a4f9cb64d298e7fd0691c4d09679872922.tar.bz2 android-node-v8-6df7b6a4f9cb64d298e7fd0691c4d09679872922.zip |
esm: implement "pkg-exports" proposal
Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36
PR-URL: https://github.com/nodejs/node/pull/28568
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/es-module')
-rw-r--r-- | test/es-module/test-esm-exports.mjs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/es-module/test-esm-exports.mjs b/test/es-module/test-esm-exports.mjs new file mode 100644 index 0000000000..8811502665 --- /dev/null +++ b/test/es-module/test-esm-exports.mjs @@ -0,0 +1,28 @@ +// Flags: --experimental-modules --experimental-exports + +import { mustCall } from '../common/index.mjs'; +import { ok, strictEqual } from 'assert'; + +import { asdf, asdf2 } from '../fixtures/pkgexports.mjs'; +import { + loadMissing, + loadFromNumber, + loadDot, +} from '../fixtures/pkgexports-missing.mjs'; + +strictEqual(asdf, 'asdf'); +strictEqual(asdf2, 'asdf'); + +loadMissing().catch(mustCall((err) => { + ok(err.message.toString().startsWith('Package exports')); + ok(err.message.toString().indexOf('do not define a \'./missing\' subpath')); +})); + +loadFromNumber().catch(mustCall((err) => { + ok(err.message.toString().startsWith('Package exports')); + ok(err.message.toString().indexOf('do not define a \'./missing\' subpath')); +})); + +loadDot().catch(mustCall((err) => { + ok(err.message.toString().startsWith('Cannot find main entry point')); +})); |