From b251040fa33c11a880050e87a0461053ab4e6aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Thu, 26 Feb 2026 13:58:23 -0600 Subject: [PATCH] Pre-compile the app bundle and run tests against that Speed difference is 3min vs 30sec to run all tests. --- playwright.config.ts | 4 +++- tests/support/globalSetup.ts | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/playwright.config.ts b/playwright.config.ts index 0aeac7774..d3fee4d9d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -84,10 +84,12 @@ const config: PlaywrightTestConfig = { webServer: [ { - command: "npm run start -- --strictPort --port 3001", + // Use preview server (pre-built app) for main server - much faster startup + command: "npm run serve -- --strictPort --port 3001", port: 3001, }, // Required by test tests/e2e/repo/commits.spec.ts "loading more commits, adds them to the commits list" + // Keep dev server here since it needs custom runtime config { command: "npm run start -- --strictPort --port 3002", port: 3002, diff --git a/tests/support/globalSetup.ts b/tests/support/globalSetup.ts index 0a9b755dd..abec90ebd 100644 --- a/tests/support/globalSetup.ts +++ b/tests/support/globalSetup.ts @@ -53,6 +53,13 @@ export default async function globalSetup(): Promise<() => void> { process.exit(1); } + // Build the app once before running tests to avoid compilation + // overhead on each worker. + console.log("Building the app for tests..."); + const { execa: exec } = await import("execa"); + await exec("npm", ["run", "build"], { stdio: "inherit" }); + console.log("Build complete"); + if (!process.env.SKIP_FIXTURE_CREATION) { console.log( "Recreating static fixtures. Set SKIP_FIXTURE_CREATION to skip this",