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(() => {