31 lines
961 B
TypeScript
31 lines
961 B
TypeScript
import { defineConfig } from "vitest/config";
|
|
import { config as dotenvConfig } from "dotenv";
|
|
import { join } from "path";
|
|
|
|
dotenvConfig({ path: join(__dirname, ".env") });
|
|
|
|
// Tests run against a dedicated database so they never touch dev data.
|
|
process.env.NODE_ENV = "test";
|
|
process.env.DATABASE_URL =
|
|
process.env.TEST_DATABASE_URL ||
|
|
"postgresql://patchpass:patchpass@localhost:5433/patchpass_test";
|
|
// Deterministic secret so signature assertions are stable.
|
|
process.env.INSTANCE_SECRET =
|
|
process.env.INSTANCE_SECRET || "test_instance_secret_for_signing_receipts_0001";
|
|
process.env.LOG_LEVEL = process.env.LOG_LEVEL || "silent";
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: "node",
|
|
include: ["src/tests/**/*.test.ts"],
|
|
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
globalSetup: ["src/tests/globalSetup.ts"],
|
|
fileParallelism: false,
|
|
coverage: {
|
|
provider: "v8",
|
|
reporter: ["text", "json", "html"],
|
|
},
|
|
},
|
|
});
|