this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: run e2e tests with both webpack and turbopack (#1018)

authored by

Victor Berchet and committed by
GitHub
54717122 2a3ee86b

+60 -21
+8 -5
.github/workflows/playwright.yml
··· 19 19 - name: Install Playwright 20 20 uses: ./.github/actions/setup-playwright 21 21 22 - - name: Build the tool 23 - run: pnpm build 24 - 25 - - name: Build all workers 22 + - name: Build workers (webpack) 26 23 run: pnpm -r build:worker 27 24 28 - - name: Run playwright tests 25 + - name: Run playwright tests (webpack) 29 26 run: pnpm e2e 27 + 28 + - name: Build workers (turbopack) 29 + run: pnpm -r build:worker-turbopack 30 + 31 + - name: Run playwright tests (turbopack) 32 + run: pnpm e2e-turbopack 30 33 31 34 - name: Run playwright dev tests 32 35 run: pnpm e2e:dev
+8 -9
examples/common/config-e2e.ts
··· 1 1 import { defineConfig, devices } from "@playwright/test"; 2 - import type nodeProcess from "node:process"; 2 + import { execSync } from "node:child_process"; 3 3 import { getAppPort, getInspectorPort, type AppName } from "./apps"; 4 4 5 5 declare const process: typeof nodeProcess; ··· 15 15 multipleBrowsers = false, 16 16 // Whether to run tests in single file in parallel 17 17 parallel = true, 18 + // Use the turbopack runtime 19 + useTurbopack = false, 18 20 } = {} 19 21 ) { 20 22 const port = getAppPort(app, { isWorker }); ··· 23 25 let command: string; 24 26 let timeout: number; 25 27 if (isWorker) { 28 + // Do not build on CI - there is a preceding build step 29 + command = isCI ? "" : `pnpm ${useTurbopack ? "build:worker-turbopack" : "build:worker"} && `; 30 + 26 31 const env = app === "r2-incremental-cache" ? "--env e2e" : ""; 27 - if (isCI) { 28 - // Do not build on CI - there is a preceding build step 29 - command = `pnpm preview:worker -- --port ${port} --inspector-port ${inspectorPort} ${env}`; 30 - timeout = 800_000; 31 - } else { 32 - timeout = 800_000; 33 - command = `pnpm preview -- --port ${port} --inspector-port ${inspectorPort} ${env}`; 34 - } 32 + command += `pnpm preview:worker -- --port ${port} --inspector-port ${inspectorPort} ${env}`; 33 + timeout = 800_000; 35 34 } else { 36 35 timeout = 100_000; 37 36 command = `pnpm dev --port ${port}`;
+1 -1
examples/e2e/app-pages-router/e2e/playwright.config.ts
··· 1 1 import { configurePlaywright } from "../../../common/config-e2e"; 2 2 3 - export default configurePlaywright("app-pages-router"); 3 + export default configurePlaywright("app-pages-router", { useTurbopack: false });
+3
examples/e2e/app-pages-router/e2e/playwright.turbopack.config.ts
··· 1 + import { configurePlaywright } from "../../../common/config-e2e"; 2 + 3 + export default configurePlaywright("app-pages-router", { useTurbopack: true });
+7
examples/e2e/app-pages-router/open-next.turbopack.config.ts
··· 1 + import config from "./open-next.config.js"; 2 + 3 + export default { 4 + ...config, 5 + // Override the build command to use Turbopack 6 + buildCommand: "next build --turbopack", 7 + };
+3 -1
examples/e2e/app-pages-router/package.json
··· 12 12 "build:worker": "pnpm opennextjs-cloudflare build", 13 13 "preview:worker": "pnpm opennextjs-cloudflare preview", 14 14 "preview": "pnpm build:worker && pnpm preview:worker", 15 - "e2e": "playwright test -c e2e/playwright.config.ts" 15 + "e2e": "playwright test -c e2e/playwright.config.ts", 16 + "build:worker-turbopack": "pnpm opennextjs-cloudflare build --openNextConfigPath open-next.turbopack.config.ts", 17 + "e2e-turbopack": "playwright test -c e2e/playwright.turbopack.config.ts" 16 18 }, 17 19 "dependencies": { 18 20 "@opennextjs/cloudflare": "workspace:*",
+1 -1
examples/e2e/app-router/e2e/playwright.config.ts
··· 1 1 import { configurePlaywright } from "../../../common/config-e2e"; 2 2 3 - export default configurePlaywright("app-router"); 3 + export default configurePlaywright("app-router", { useTurbopack: false });
+3
examples/e2e/app-router/e2e/playwright.turbopack.config.ts
··· 1 + import { configurePlaywright } from "../../../common/config-e2e"; 2 + 3 + export default configurePlaywright("app-router", { useTurbopack: true });
+7
examples/e2e/app-router/open-next.turbopack.config.ts
··· 1 + import config from "./open-next.config.js"; 2 + 3 + export default { 4 + ...config, 5 + // Override the build command to use Turbopack 6 + buildCommand: "next build --turbopack", 7 + };
+3 -1
examples/e2e/app-router/package.json
··· 12 12 "build:worker": "pnpm opennextjs-cloudflare build", 13 13 "preview:worker": "pnpm opennextjs-cloudflare preview", 14 14 "preview": "pnpm build:worker && pnpm preview:worker", 15 - "e2e": "playwright test -c e2e/playwright.config.ts" 15 + "e2e": "playwright test -c e2e/playwright.config.ts", 16 + "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", 17 + "e2e-turbopack": "playwright test -c e2e/playwright.turbopack.config.ts" 16 18 }, 17 19 "dependencies": { 18 20 "@opennextjs/cloudflare": "workspace:*",
+1 -1
examples/e2e/pages-router/e2e/playwright.config.ts
··· 1 1 import { configurePlaywright } from "../../../common/config-e2e"; 2 2 3 - export default configurePlaywright("pages-router"); 3 + export default configurePlaywright("pages-router", { useTurbopack: false });
+3
examples/e2e/pages-router/e2e/playwright.turbopack.config.ts
··· 1 + import { configurePlaywright } from "../../../common/config-e2e"; 2 + 3 + export default configurePlaywright("pages-router", { useTurbopack: true });
+7
examples/e2e/pages-router/open-next.turbopack.config.ts
··· 1 + import config from "./open-next.config.js"; 2 + 3 + export default { 4 + ...config, 5 + // Override the build command to use Turbopack 6 + buildCommand: "next build --turbopack", 7 + };
+3 -1
examples/e2e/pages-router/package.json
··· 12 12 "build:worker": "pnpm opennextjs-cloudflare build", 13 13 "preview:worker": "pnpm opennextjs-cloudflare preview", 14 14 "preview": "pnpm build:worker && pnpm preview:worker", 15 - "e2e": "playwright test -c e2e/playwright.config.ts" 15 + "e2e": "playwright test -c e2e/playwright.config.ts", 16 + "build:worker-turbopack": "pnpm build:worker --openNextConfigPath open-next.turbopack.config.ts", 17 + "e2e-turbopack": "playwright test -c e2e/playwright.turbopack.config.ts" 16 18 }, 17 19 "dependencies": { 18 20 "@opennextjs/cloudflare": "workspace:*",
+2 -1
package.json
··· 12 12 "scripts": { 13 13 "fix": "pnpm prettier:fix && pnpm lint:fix", 14 14 "build": "pnpm --filter cloudflare build", 15 - "test": "pnpm -r test", 15 + "test": "pnpm build && pnpm -r test", 16 16 "e2e": "pnpm build && pnpm -r e2e", 17 + "e2e-turbopack": "pnpm build && pnpm -r e2e-turbopack", 17 18 "e2e:dev": "pnpm build && pnpm -r e2e:dev", 18 19 "prettier:check": "prettier --check .", 19 20 "prettier:fix": "prettier --write .",