From 9f168cf4c8fc3130538f06075fd6ec06937203b0 Mon Sep 17 00:00:00 2001 From: siddharthd Date: Sun, 26 Jul 2026 19:50:21 +1000 Subject: [PATCH] test(orders): stop integration files racing on the shared test database MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The integration suite shares one personal_test database and helpers.resetDB() TRUNCATEs it with CASCADE, which reaches expense_metadata via the transactions FK. With file parallelism on, queries.test.ts and participants.test.ts were truncating rows out from under order-ingestion.test.ts mid-test, so a different set of assertions failed on every run — including I6 (credits), I7 (idempotency) and I11 ([Family]), the three invariants the suite exists to prove. Serialise the files. Suite was reported 31/31 green; observed 29/31 then 28/31 on consecutive runs. Now 31/31 on three consecutive runs. --- vitest.integration.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index 2f38feb..3bb0292 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -20,5 +20,10 @@ export default defineConfig({ environment: "node", include: ["src/__tests__/integration/**/*.test.ts"], pool: "forks", + // Every integration file shares the one `personal_test` database, and + // helpers.resetDB() TRUNCATEs it (CASCADE reaches expense_metadata). + // Run files one at a time so a sibling's reset cannot delete rows another + // file just inserted — that raced non-deterministically across I6/I7/I11. + fileParallelism: false, }, });