@devries-cameron20 / t3code-1 / commits / 89b42bfeb4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

test(web): browser tests from different checkouts no longer fight over one port (#20875)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 17, 2026 at 03:05 UTC 89b42bfeb4f79408af72fc7bb7a4482e22bb9493
1 file changed +8
apps/web/vite.config.ts
+8
@@ -7,6 +7,7 @@ import { playwright } from "vite-plus/test/browser-playwright";
7 import { defineProject, type TestProjectInlineConfiguration } from "vite-plus/test/config";
8 import "vite-plus/test/config";
9 import { defineConfig, type Connect, type Plugin } from "vite-plus";
10 +import * as Hash from "effect/Hash";
11 import pkg from "./package.json" with { type: "json" };
12
13 import {
@@ -80,6 +81,12 @@ const unitTestProject = {
81
82 // Anything that renders React or touches the DOM is named *.browser.test.{ts,tsx} and runs
83 // in headless Chromium through the same plugins as the app, so it exercises compiled code.
84 +// Vitest's fixed browser API port (63315) collides when two checkouts run
85 +// browser tests at once, and `server.strictPort` above is inherited, so the
86 +// second run fails instead of moving on. Hash the checkout path like
87 +// scripts/dev-runner.ts does, into 61000-64999 (above Linux's ephemeral range).
88 +const browserTestApiPort = 61_000 + ((Hash.string(import.meta.dirname) >>> 0) % 4_000);
89 +
90 const browserTestProject = {
91 extends: true,
92 // Pre-bundled so the first test importing userEvent does not trigger a mid-run reload.
@@ -89,6 +96,7 @@ const browserTestProject = {
96 include: ["src/**/*.browser.test.{ts,tsx}"],
97 hookTimeout: 15_000,
98 testTimeout: 15_000,
99 + api: { port: browserTestApiPort, strictPort: false },
100 browser: {
101 enabled: true,
102 headless: true,