Full 'pnpm test' previously hung indefinitely (killed at CI walls, misdiagnosed as teardown slowness). Two root causes found and fixed: 1. RightInspector.test.tsx called setSubject() during render with a fresh object every pass -> infinite synchronous render loop (100% CPU spin, blocks the event loop so no timeout can fire). Moved into useEffect. 2. Test QueryClients used retry:false but default gcTime (5 min) -> a live GC timer per cached query kept workers from exiting. New shared createTestQueryClient() with gcTime:0 adopted across all 7 test files. Hardening so any future leak fails loudly instead of hanging: - vite.config.ts: testTimeout/hookTimeout 10s, teardownTimeout 5s - useManagedTimeout hook owns previously-bare setTimeouts in DigestBadge, MetadataTable, RatificationCommandPanel (4 sites), CommandPalette focus First-ever frontend CI lane (.github/workflows/workbench-ui.yml): path-filtered to workbench-ui/** AND the workflow file itself, pnpm install --frozen-lockfile + build + vitest, timeout-minutes 15. Honesty fix: KeyboardHelp no longer advertises j/k, /, Enter (unbuilt until R0d restores them registry-backed). Route conformance test (ADR-0162 §6, executable): empty/error/loading contracts asserted for Chat/Proposals/Evals/Replay; fixed the two gaps it caught (ReplayRoute bare-div error branch -> ErrorState contract; ArtifactList empty state gained a next action). Result: 27 files / 181 tests pass, suite EXITS in 4.9s wall-clock (was: indefinite hang).
18 lines
589 B
TypeScript
18 lines
589 B
TypeScript
import { QueryClient } from "@tanstack/react-query";
|
|
|
|
/**
|
|
* QueryClient for tests.
|
|
*
|
|
* `gcTime: 0` is load-bearing: TanStack Query v5 defaults to 5 minutes,
|
|
* which schedules a garbage-collection timer per cached query. Those live
|
|
* timers keep vitest workers from exiting at teardown — the root cause of
|
|
* the full-suite hang diagnosed 2026-06-12 (Wave R brief R0a).
|
|
*/
|
|
export function createTestQueryClient(): QueryClient {
|
|
return new QueryClient({
|
|
defaultOptions: {
|
|
queries: { retry: false, gcTime: 0 },
|
|
mutations: { retry: false, gcTime: 0 },
|
|
},
|
|
});
|
|
}
|