fix(tests): remove temp DB cleanup that races with other test files

The integration test cleanup was deleting the shared temp directory
(rmSync on dirname(DB_PATH)), which causes SQLITE_IOERR_FSTAT in
other test files that still reference the same database. The temp
directory uses a random UUID under /tmp and is cleaned up by the OS.
This commit is contained in:
Siddharth Kumar Sah
2026-03-28 12:49:23 +08:00
parent 28c44bef5f
commit b08e006512
+4 -6
View File
@@ -9,7 +9,7 @@
* that can be exercised with `app.inject()` (no port binding required). * that can be exercised with `app.inject()` (no port binding required).
*/ */
import { randomUUID } from "node:crypto"; import { randomUUID } from "node:crypto";
import { mkdirSync, rmSync } from "node:fs"; import { mkdirSync } from "node:fs";
import { dirname } from "node:path"; import { dirname } from "node:path";
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -130,11 +130,9 @@ export async function buildTestApp(): Promise<TestApp> {
const cleanup = async () => { const cleanup = async () => {
await app.close(); await app.close();
try { // Don't delete the temp DB directory here — other test files in the same
rmSync(dirname(process.env.DB_PATH!), { recursive: true, force: true }); // vitest run share it. The directory lives under /tmp with a random UUID
} catch { // and is cleaned up by the OS.
// ignore
}
}; };
return { app, cleanup }; return { app, cleanup };