yap-blog/tests/setup-env.ts
2026-07-02 21:32:33 -04:00

13 lines
385 B
TypeScript

import "dotenv/config";
import { afterAll } from "vitest";
// Runs before each test file's imports: point the app's db module at the
// test database instead of the development one.
process.env.DATABASE_URL =
process.env.TEST_DATABASE_URL || "postgresql://blog:blog@localhost:5434/blog_test";
afterAll(async () => {
const { pool } = await import("@/db");
await pool.end();
});