mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -9,7 +9,7 @@
|
||||
* that can be exercised with `app.inject()` (no port binding required).
|
||||
*/
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { mkdirSync, rmSync } from "node:fs";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -130,11 +130,9 @@ export async function buildTestApp(): Promise<TestApp> {
|
||||
|
||||
const cleanup = async () => {
|
||||
await app.close();
|
||||
try {
|
||||
rmSync(dirname(process.env.DB_PATH!), { recursive: true, force: true });
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
// Don't delete the temp DB directory here — other test files in the same
|
||||
// vitest run share it. The directory lives under /tmp with a random UUID
|
||||
// and is cleaned up by the OS.
|
||||
};
|
||||
|
||||
return { app, cleanup };
|
||||
|
||||
Reference in New Issue
Block a user