Skip to content

Commit d48cfcb

Browse files
authored
test(e2e): add case for package.json imports resolution (#6715)
1 parent 49e4174 commit d48cfcb

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { expect, test } from '@e2e/helper';
2+
3+
test('should resolve package.json imports field in dev', async ({ page, dev }) => {
4+
await dev();
5+
6+
const app = page.locator('#app');
7+
await expect(app).toHaveText('imports field works');
8+
});
9+
10+
test('should resolve package.json imports field in build', async ({
11+
page,
12+
buildPreview,
13+
}) => {
14+
await buildPreview();
15+
16+
const app = page.locator('#app');
17+
await expect(app).toHaveText('imports field works');
18+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@e2e/resolve-node-imports-field",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"imports": {
7+
"#app/*": "./src/*.js"
8+
}
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const message = 'imports field works';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { message } from '#app/foo';
2+
3+
const app = document.createElement('div');
4+
app.id = 'app';
5+
app.textContent = message;
6+
7+
document.body.appendChild(app);

0 commit comments

Comments
 (0)