From e0617e47abd3209ea4f68688e264439e75c5ee46 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Fri, 28 Aug 2026 05:07:32 -0700 Subject: [PATCH 1/2] Run every scripts/*.test.ts in the test gate The root test script only ran scripts/run-all.test.ts by name, so scripts/affected.test.ts, dev.test.ts, reset.test.ts, and setup-memory.test.ts (33 tests) never ran locally or in CI. Widen the bun test invocation to the shell-expanded scripts/*.test.ts glob, which picks up exactly the five top-level suites and does not recurse into scripts/e2e or scripts/checks/test (those keep their own jobs). Fixes CL-7122. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8af8aa2cc..9b1e594c6 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "lint": "prettier --check --cache . && eslint --cache .", "format": "prettier --write .", "build": "bun run scripts/run-all.ts build", - "test": "bun test scripts/run-all.test.ts && bun run scripts/run-all.ts test", + "test": "bun test ./scripts/*.test.ts && bun run scripts/run-all.ts test", "test:e2e": "bun test scripts/e2e", "dev": "bun run scripts/dev.ts", "setup": "bun packages/cli/src/index.ts setup", From d3b87ca5386dc9c25132c0b7fc63869fcde7802a Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Sat, 29 Aug 2026 14:21:14 -0700 Subject: [PATCH 2/2] Skip db-setup tests without parsing an empty DATABASE_URL bun still runs the describe callback under describe.skip, so dbTargetFromUrl at describe scope crashed build-test when the glob wired this file in. Parse and connect inside the test instead. --- scripts/db-setup.test.ts | 42 +++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/scripts/db-setup.test.ts b/scripts/db-setup.test.ts index 1eda4c333..29b7d2e25 100644 --- a/scripts/db-setup.test.ts +++ b/scripts/db-setup.test.ts @@ -3,7 +3,7 @@ // the pre-re-pin numbering of workbench's own two migrations) is refused // with the reset instruction instead of being patched incrementally. // DB-gated: skipped when DATABASE_URL is unset. -import { afterAll, describe, expect, test } from "bun:test"; +import { describe, expect, test } from "bun:test"; import { dbTargetFromUrl, loadPostgres, setupDatabase } from "./db-setup"; @@ -19,32 +19,30 @@ const OLD_NUMBERING_TAIL = [ describeIfDb( "setupDatabase against a schema migrated under the old numbering", () => { - const schema = `db_setup_test_${Date.now().toString(36)}`; - const target = dbTargetFromUrl(databaseUrl); - const client = loadPostgres().then((postgres) => - postgres({ ...target, max: 1, onnotice: () => undefined }), - ); - afterAll(async () => { - const sql = await client; - await sql.unsafe(`DROP SCHEMA IF EXISTS "${schema}" CASCADE`); - await sql.end(); - }); - test("refuses to apply incrementally and names the reset", async () => { - const sql = await client; - await sql.unsafe(`CREATE SCHEMA "${schema}"`); - await sql.unsafe( - `CREATE TABLE "${schema}"."workbench_setup_migration" (filename text PRIMARY KEY, applied_at timestamptz NOT NULL DEFAULT now())`, + const schema = `db_setup_test_${Date.now().toString(36)}`; + const target = dbTargetFromUrl(databaseUrl); + const sql = await loadPostgres().then((postgres) => + postgres({ ...target, max: 1, onnotice: () => undefined }), ); - for (const file of OLD_NUMBERING_TAIL) { + try { + await sql.unsafe(`CREATE SCHEMA "${schema}"`); await sql.unsafe( - `INSERT INTO "${schema}"."workbench_setup_migration" (filename) VALUES ($1)`, - [file], + `CREATE TABLE "${schema}"."workbench_setup_migration" (filename text PRIMARY KEY, applied_at timestamptz NOT NULL DEFAULT now())`, ); + for (const file of OLD_NUMBERING_TAIL) { + await sql.unsafe( + `INSERT INTO "${schema}"."workbench_setup_migration" (filename) VALUES ($1)`, + [file], + ); + } + await expect(setupDatabase(databaseUrl, { schema })).rejects.toThrow( + /different @intx\/db migration set[\s\S]*db-setup\.ts --reset/, + ); + } finally { + await sql.unsafe(`DROP SCHEMA IF EXISTS "${schema}" CASCADE`); + await sql.end(); } - await expect(setupDatabase(databaseUrl, { schema })).rejects.toThrow( - /different @intx\/db migration set[\s\S]*db-setup\.ts --reset/, - ); }); }, );