Pre-compile the app bundle and run tests against that

Speed difference is 3min vs 30sec to run all tests.
This commit is contained in:
Rūdolfs Ošiņš
2026-02-26 14:57:56 -06:00
parent dd243612b8
commit b251040fa3
2 changed files with 10 additions and 1 deletions
+3 -1
View File
@@ -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,
+7
View File
@@ -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",