test(examples): give each run its own sqlite database

The test profile pointed at ./test.db in the app directory, so a run inherited
whatever schema an earlier run left behind. On a machine with a stale file,
0003_add_password re-applied ALTER TABLE ADD COLUMN over a column that already
existed; fail-on-test-warnings turned the warning into a failure, and
check:production failed for environment reasons rather than code.

Each run now uses a fresh database under the OS temp directory. Verified by
restoring the stale dev.db and test.db that reproduced the failure: the suite
passes with them present.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 17:38:28 +05:30
co-authored by Claude Opus 5
parent 2425a5146f
commit 94a6b436f5
3 changed files with 27 additions and 3 deletions
+11 -1
View File
@@ -1,3 +1,6 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AppConfig } from "@wrnexus/styles";
/**
@@ -100,7 +103,14 @@ const config: AppConfig = {
seo: { title: "WrNexus (UAT)", robots: "noindex,nofollow" },
},
test: {
db: { driver: "sqlite", url: "file:./test.db" },
// A fresh database per run. A file checked into the working tree would
// carry a schema from an earlier run, and a migration such as
// 0003_add_password then re-applies against a column that already
// exists, failing the suite on developer machines but not on CI.
db: {
driver: "sqlite",
url: `file:${join(tmpdir(), `wrnexus-test-${process.pid}.db`)}`,
},
},
},
};
@@ -1,3 +1,6 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AppConfig } from "@wrnexus/styles";
const config: AppConfig = {
@@ -133,7 +136,11 @@ const config: AppConfig = {
profiles: {
development: {},
test: {
db: { driver: "sqlite", url: "file:./test.db" },
// A fresh database per run; a persisted file carries an earlier schema.
db: {
driver: "sqlite",
url: `file:${join(tmpdir(), `wrnexus-test-${process.pid}.db`)}`,
},
observability: { exporter: "none", sampleRate: 0 },
},
staging: {
@@ -1,3 +1,6 @@
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AppConfig } from "@wrnexus/styles";
const config: AppConfig = {
@@ -133,7 +136,11 @@ const config: AppConfig = {
profiles: {
development: {},
test: {
db: { driver: "sqlite", url: "file:./test.db" },
// A fresh database per run; a persisted file carries an earlier schema.
db: {
driver: "sqlite",
url: `file:${join(tmpdir(), `wrnexus-test-${process.pid}.db`)}`,
},
observability: { exporter: "none", sampleRate: 0 },
},
staging: {