fix: resolve smoke test failures -- CLI JSON output, port collision, stale DBs

This commit is contained in:
Matt Kane
2026-04-02 15:30:36 +01:00
parent 01af46fb83
commit 8e28cfc5d6
12 changed files with 64 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ import { describe, it, expect, beforeAll, afterAll } from "vitest";
import type { TestServerContext } from "../server.js";
import { assertNodeVersion, createTestServer } from "../server.js";
const PORT = 4398;
const PORT = 4396;
const TIMEOUT = 60_000;
/** Helper: raw fetch with auth headers */

View File

@@ -1,5 +1,6 @@
import { execFile, spawn } from "node:child_process";
import { resolve } from "node:path";
import { rmSync } from "node:fs";
import { join, resolve } from "node:path";
import { promisify } from "node:util";
import { describe, expect, it } from "vitest";
@@ -203,6 +204,12 @@ describe.sequential("Site smoke matrix", () => {
async () => {
await ensureBuilt();
// Remove stale database files so each run starts fresh.
// SQLite demos use data.db; WAL/SHM sidecars may also exist.
for (const file of ["data.db", "data.db-wal", "data.db-shm"]) {
rmSync(join(site.dir, file), { force: true });
}
const baseUrl = `http://localhost:${site.port}`;
const serverProcess = spawn("pnpm", ["exec", "astro", "dev", "--port", String(site.port)], {
cwd: site.dir,