← back to Homesonspec

apps/workers/vitest.integration.setup.ts

9 lines

// Point the Prisma singleton at the TEST database before any test module
// imports @homesonspec/database. Refuses to run against a non-test DB.
const testUrl =
  process.env.DATABASE_URL_TEST ?? "postgresql://macstudio3@localhost/homesonspec_test?host=/tmp";
if (!/homesonspec_test/.test(testUrl)) {
  throw new Error(`integration tests require a *_test database, got: ${testUrl}`);
}
process.env.DATABASE_URL = testUrl;