From 55f699ae4c584910f9aaf147cf900fa1dca3b52c Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Thu, 6 Aug 2026 17:08:28 -0700 Subject: [PATCH] fix(cli): size the vitest timeout to what the suite actually does Much of this suite is integration-shaped: tests in check, runtime-check, init, and onboard spawn the real built CLI with execFile("node", [binPath, ...]), and several lay out a fixture tree and run `git init` first. One cold CLI spawn measures ~0.8s by itself, so a test doing four or five of them sits at 3-4s before any load. Vitest's default 5s testTimeout left no margin for that. Because vitest runs test files in parallel workers competing for CPU, whichever tests landed together tipped over, so a different set failed on each run, always with "Test timed out in 5000ms" and never an assertion failure. That reads as a flaky product when it is a timeout sized below the work. Confirmed to predate any current branch: a clean checkout of main with no local changes failed 8 tests this way. With the timeout at 20s the suite passes 427/427 across three consecutive runs. 20s swallows the contention without hiding a genuine hang. --- packages/cli/vite.config.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/cli/vite.config.ts b/packages/cli/vite.config.ts index 6161c8fa..5431789e 100644 --- a/packages/cli/vite.config.ts +++ b/packages/cli/vite.config.ts @@ -170,4 +170,22 @@ export default defineConfig({ external: [/^node:/, ...builtinModules], }, }, + // Much of this suite is integration-shaped rather than unit-shaped: tests in + // check/runtime-check/init/onboard spawn the real built CLI via + // `execFile("node", [binPath, ...])`, and several lay out a fixture tree and + // run `git init` first. One cold CLI spawn measures ~0.8s by itself, so a test + // doing four or five of them sits at 3-4s before any load at all. + // + // Vitest's default 5s testTimeout left no margin for that. Since vitest runs + // test files in parallel workers competing for CPU, whichever tests happened + // to land together tipped over: a different set failed on each run, always + // with "Test timed out in 5000ms" and never an assertion. Verified against a + // clean checkout of `main` with no local changes, where 8 tests failed this + // way, so it is the suite's own sizing rather than any one change. + // + // 20s swallows the contention without hiding a genuine hang. + test: { + testTimeout: 20_000, + hookTimeout: 20_000, + }, });