From e3fcbf30bf12e04c11658a9d28a58d0e62f54660 Mon Sep 17 00:00:00 2001 From: yusufipk Date: Sun, 26 Jul 2026 15:48:55 +0700 Subject: [PATCH] fix(build): move the test db bootstrap under tests/ `.dockerignore` excludes `tests`, so the production build context carries scripts/test-db-bootstrap.ts without the tests/setup/db-global module it imports. tsconfig includes `**/*.ts`, so the `prebuild` typecheck fails on the missing module and every deploy since the test suites landed has died there. CI never saw it because tests/ exists on a runner. The script is test-only, so it belongs in the tree that is already ignored. --- package.json | 2 +- .../test-db-bootstrap.ts => tests/setup/db-bootstrap.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) rename scripts/test-db-bootstrap.ts => tests/setup/db-bootstrap.ts (70%) diff --git a/package.json b/package.json index 8358495..df8c7d6 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "verify": "bun run check && bun run test", "test:db:up": "podman compose -f docker-compose.test.yml up -d --wait postgres-test", "test:db:down": "podman compose -f docker-compose.test.yml down -v", - "test:db:bootstrap": "bun run scripts/test-db-bootstrap.ts", + "test:db:bootstrap": "bun run tests/setup/db-bootstrap.ts", "prepare": "husky", "postinstall": "prisma generate", "db:generate": "prisma generate", diff --git a/scripts/test-db-bootstrap.ts b/tests/setup/db-bootstrap.ts similarity index 70% rename from scripts/test-db-bootstrap.ts rename to tests/setup/db-bootstrap.ts index 3c6b641..e07236b 100644 --- a/scripts/test-db-bootstrap.ts +++ b/tests/setup/db-bootstrap.ts @@ -6,11 +6,15 @@ * schema in place before the server starts. Both paths therefore call the same * setup function, so there is exactly one description of how a test database is * built (including why it uses `prisma db push` rather than `migrate deploy`, - * which is documented at the top of tests/setup/db-global.ts). + * which is documented at the top of db-global.ts). + * + * This lives under tests/ rather than scripts/ because the production image + * ignores tests/ entirely, and a script that imports from it would break the + * typecheck that runs before every build. * * Usage: bun run test:db:bootstrap */ -import { setup } from '../tests/setup/db-global'; +import { setup } from './db-global'; setup() .then(() => {