Skip to content

Commit 75439ef

Browse files
authored
test(nextjs): Run e2e tests for nextjs-15 in turbopack (#17018)
1 parent 062204a commit 75439ef

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
@sentry:registry=http://127.0.0.1:4873
22
@sentry-internal:registry=http://127.0.0.1:4873
3+
public-hoist-pattern[]=*import-in-the-middle*
4+
public-hoist-pattern[]=*require-in-the-middle*

dev-packages/e2e-tests/test-applications/nextjs-15/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
"clean": "npx rimraf node_modules pnpm-lock.yaml",
88
"test:prod": "TEST_ENV=production playwright test",
99
"test:dev": "TEST_ENV=development playwright test",
10+
"test:dev-turbo": "TEST_ENV=dev-turbopack playwright test",
1011
"test:build": "pnpm install && pnpm build",
1112
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
1213
"//": "15.0.0-canary.194 is the canary release attached to Next.js RC 1. We need to use the canary version instead of the RC because PPR will not work without. The specific react version is also attached to RC 1.",
1314
"test:build-latest": "pnpm install && pnpm add next@15.0.0-canary.194 && pnpm add react@19.0.0-rc-cd22717c-20241013 && pnpm add react-dom@19.0.0-rc-cd22717c-20241013 && pnpm build",
15+
"test:build-turbo": "pnpm install && pnpm add next@15.4.2-canary.1 && next build --turbopack",
1416
"test:assert": "pnpm test:prod && pnpm test:dev"
1517
},
1618
"dependencies": {
@@ -19,7 +21,7 @@
1921
"@types/react": "18.0.26",
2022
"@types/react-dom": "18.0.9",
2123
"ai": "^3.0.0",
22-
"next": "15.3.0-canary.33",
24+
"next": "15.4.2-canary.1",
2325
"react": "beta",
2426
"react-dom": "beta",
2527
"typescript": "~5.0.0",
@@ -41,6 +43,11 @@
4143
{
4244
"build-command": "test:build-latest",
4345
"label": "nextjs-15 (latest)"
46+
},
47+
{
48+
"build-command": "test:build-turbo",
49+
"assert-command": "pnpm test:prod && pnpm test:dev-turbo",
50+
"label": "nextjs-15 (turbo)"
4451
}
4552
]
4653
}

dev-packages/e2e-tests/test-applications/nextjs-15/playwright.config.mjs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,24 @@ if (!testEnv) {
55
throw new Error('No test env defined');
66
}
77

8+
const getStartCommand = () => {
9+
if (testEnv === 'dev-turbopack') {
10+
return 'pnpm next dev -p 3030 --turbopack';
11+
}
12+
13+
if (testEnv === 'development') {
14+
return 'pnpm next dev -p 3030';
15+
}
16+
17+
if (testEnv === 'production') {
18+
return 'pnpm next start -p 3030';
19+
}
20+
21+
throw new Error(`Unknown test env: ${testEnv}`);
22+
};
23+
824
const config = getPlaywrightConfig({
9-
startCommand: testEnv === 'development' ? 'pnpm next dev -p 3030' : 'pnpm next start -p 3030',
25+
startCommand: getStartCommand(),
1026
port: 3030,
1127
});
1228

dev-packages/e2e-tests/test-applications/nextjs-15/tests/prefetch-spans.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { expect, test } from '@playwright/test';
22
import { waitForTransaction } from '@sentry-internal/test-utils';
33

44
test('Prefetch client spans should have a http.request.prefetch attribute', async ({ page }) => {
5-
test.skip(process.env.TEST_ENV === 'development', "Prefetch requests don't have the prefetch header in dev mode");
5+
test.skip(
6+
process.env.TEST_ENV === 'development' || process.env.TEST_ENV === 'dev-turbopack',
7+
"Prefetch requests don't have the prefetch header in dev mode",
8+
);
69

710
const pageloadTransactionPromise = waitForTransaction('nextjs-15', async transactionEvent => {
811
return transactionEvent?.transaction === '/prefetching';

dev-packages/e2e-tests/test-applications/nextjs-turbo/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
"test:dev": "TEST_ENV=development playwright test",
1010
"test:build": "pnpm install && pnpm build",
1111
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@canary && pnpm add react-dom@canary && pnpm build",
12-
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm add react@rc && pnpm add react-dom@rc && pnpm build",
12+
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm build",
1313
"test:assert": "pnpm test:prod && pnpm test:dev"
1414
},
1515
"dependencies": {
1616
"@sentry/nextjs": "latest || *",
1717
"@types/node": "^18.19.1",
18-
"@types/react": "18.0.26",
19-
"@types/react-dom": "18.0.9",
18+
"@types/react": "^19",
19+
"@types/react-dom": "^19",
2020
"next": "^15.3.5",
21-
"react": "rc",
22-
"react-dom": "rc",
21+
"react": "^19",
22+
"react-dom": "^19",
2323
"typescript": "~5.0.0"
2424
},
2525
"devDependencies": {

0 commit comments

Comments
 (0)