aboutsummaryrefslogtreecommitdiff
path: root/test/es-module
diff options
context:
space:
mode:
Diffstat (limited to 'test/es-module')
-rw-r--r--test/es-module/test-esm-exports.mjs28
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'));
+}));