mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
`.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.
27 lines
997 B
TypeScript
27 lines
997 B
TypeScript
/**
|
|
* Builds the test database schema outside of Vitest.
|
|
*
|
|
* The `api` Vitest project gets this for free through its globalSetup, but the
|
|
* end-to-end suite runs the real app against the same database and needs the
|
|
* 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 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 './db-global';
|
|
|
|
setup()
|
|
.then(() => {
|
|
console.log('Test database schema is ready');
|
|
})
|
|
.catch((error: unknown) => {
|
|
console.error(error instanceof Error ? error.message : error);
|
|
process.exit(1);
|
|
});
|