From e8508e6d038b28079bced8b8cf856fd545f33a00 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Mon, 17 Aug 2026 22:19:52 +0200 Subject: [PATCH] test: isolate test files to stop cross-file mock leakage Without isolation the files in a worker share one module registry, so a vi.mock of @reactive-resume/env/server in one file leaked into another and whichever file imported the module first won. Measured on a clean cache, isolate: false failed four of four whole-repo runs; with isolation, none. --- vitest.shared.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vitest.shared.ts b/vitest.shared.ts index ce9ddaa1b..59557283e 100644 --- a/vitest.shared.ts +++ b/vitest.shared.ts @@ -44,7 +44,9 @@ export const createVitestProjectConfig = ({ include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"], exclude: ["node_modules", "dist", ".output", "coverage", "reports"], pool: "threads", - isolate: false, + // Isolation stays on: without it, test files in a worker share one module registry, so a + // `vi.mock` in one file leaks into another and whichever file imported a module first wins. + // That made every suite mocking `@reactive-resume/env/server` order-dependent and flaky. passWithNoTests: true, coverage: { provider: "v8",