Skip to content

Commit 302f011

Browse files
committed
chore(compartment-mapper): add tests for import() in ESM
This adds missing tests to assert support of `import()` in ES module sources. As expected, it does not work within archives.
1 parent 87b8b4d commit 302f011

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'ses';
2+
3+
import test from 'ava';
4+
import { scaffold } from './scaffold.js';
5+
6+
const fixture = new URL(
7+
'fixtures-dynamic-import-esm/node_modules/app/index.js',
8+
import.meta.url,
9+
).toString();
10+
11+
scaffold(
12+
'fixtures-dynamic-import-esm',
13+
test,
14+
fixture,
15+
async (t, { namespace }) => {
16+
// @ts-expect-error - untyped
17+
const foo = await namespace.getFoo();
18+
t.is(foo, 'foo');
19+
},
20+
1,
21+
{
22+
knownArchiveFailure: true,
23+
},
24+
);

packages/compartment-mapper/test/fixtures-dynamic-import-esm/node_modules/app/foo.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compartment-mapper/test/fixtures-dynamic-import-esm/node_modules/app/index.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compartment-mapper/test/fixtures-dynamic-import-esm/node_modules/app/package.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)