mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
dcb6929183
Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36 Refs: https://github.com/nodejs/node/pull/28568 PR-URL: https://github.com/nodejs/node/pull/28759 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
30 lines
868 B
JavaScript
30 lines
868 B
JavaScript
// Flags: --experimental-modules
|
|
|
|
import { mustCall } from '../common/index.mjs';
|
|
import { ok, strictEqual } from 'assert';
|
|
|
|
import { asdf, asdf2, space } from '../fixtures/pkgexports.mjs';
|
|
import {
|
|
loadMissing,
|
|
loadFromNumber,
|
|
loadDot,
|
|
} from '../fixtures/pkgexports-missing.mjs';
|
|
|
|
strictEqual(asdf, 'asdf');
|
|
strictEqual(asdf2, 'asdf');
|
|
strictEqual(space, 'encoded path');
|
|
|
|
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'));
|
|
}));
|