2d838857d55021e14718dee8bd813fbb0f64c4ed
Each test file gets its own throwaway Postgres database by mutating process.env.DATABASE_URL in tests/setup.ts's beforeAll. That per-file DB switch is not safe under Vitest's default parallel file execution: timing between two files' beforeAll/query calls can interleave enough that both end up issuing real queries against the same throwaway DB. This was invisible before because no two test files shared tables with a real FK between them. It became visible once Request gained a real FK to Employee: tests/employees.test.ts and tests/requests.test.ts started intermittently deleting/reading each other's rows (FK violations on deleteMany, wrong row counts), reproducible on every run. Setting fileParallelism: false makes each file run to completion before the next starts, so the per-file throwaway DB is genuinely private. Confirmed: 31/31 tests pass reliably under plain npm test (previously reproducibly 4 failing).
Description
No description provided
950 KiB
Languages
TypeScript
98%
CSS
1.7%
Dockerfile
0.2%