fix(tests): prevent SQLITE_BUSY race by running tests in a single fork

vitest was spawning multiple worker processes (one per test file) that
each independently opened the same SQLite database and raced to set
journal_mode = WAL. Adding pool: "forks" with singleFork: true runs all
test files in the same child process, eliminating the concurrent-open
race. The test suite (~830 tests) remains fast enough for CI.
This commit is contained in:
Siddharth Kumar Sah
2026-04-14 22:27:32 +08:00
parent 86ae18b153
commit 0f156d13a3
+8
View File
@@ -14,6 +14,14 @@ export default defineConfig({
globals: true,
testTimeout: 30_000,
hookTimeout: 30_000,
// Run all test files in a single forked process so integration tests share
// the same SQLite connection and avoid SQLITE_BUSY races on WAL setup.
pool: "forks",
poolOptions: {
forks: {
singleFork: true,
},
},
exclude: [
"tests/e2e/**",
"**/node_modules/**",