Files
patchpass/Backend/src/tests/globalSetup.ts
T
Space-Banane 7e05dd918c
Deploy / Build (push) Successful in 28s
Deploy / Test & Lint (push) Failing after 29s
Deploy / Build and Push Docker Image (push) Has been skipped
Patchpass V1
2026-07-18 20:14:44 +02:00

19 lines
562 B
TypeScript

import { execSync } from "child_process";
import { join } from "path";
/**
* Vitest global setup — bring the test database schema up to date via Prisma
* migrations before any test runs. Runs once for the whole suite.
*/
export default function setup() {
const backendRoot = join(__dirname, "../..");
const dbUrl =
process.env.TEST_DATABASE_URL ||
"postgresql://patchpass:patchpass@localhost:5433/patchpass_test";
execSync("npx prisma migrate deploy", {
cwd: backendRoot,
env: { ...process.env, DATABASE_URL: dbUrl },
stdio: "inherit",
});
}