From e206ead9f40e11ec305c93c2f76895de3beda892 Mon Sep 17 00:00:00 2001 From: Kieran Klukas Date: Mon, 27 Jul 2026 20:04:12 +0000 Subject: [PATCH] bug: add proper preload to keep test data in mem --- bunfig.toml | 2 ++ test/preload.ts | 8 ++++++++ 2 file(s) changed, 10 insertion(s)(+), 0 deletion(s)(-) diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[test] +preload = ["./test/preload.ts"] diff --git a/test/preload.ts b/test/preload.ts new file mode 100644 --- /dev/null +++ b/test/preload.ts @@ -0,0 +1,8 @@ +// Force tests onto an in-memory database BEFORE any src/ module is imported. +// +// This MUST run as a bunfig [test] preload. Setting the env var inside +// test/helpers/db.ts is too late: test files statically import src/ routes +// (which import src/db) before the helper body runs, so src/db would already +// have opened the real data/indiko.db. A preload runs first, guaranteeing +// src/db sees :memory: on its very first evaluation. +process.env.DATABASE_URL = ":memory:"; -- tangled.sh