lilith-platform.live/codebase/@features/admin/backend-api/vitest.config.ts
2026-04-05 10:48:46 -07:00

25 lines
808 B
TypeScript

import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'node',
globals: false,
setupFiles: ['./src/__tests__/setup.ts'],
env: {
// DB_PATH is intentionally NOT set here — setup.ts generates a unique
// per-process path using process.pid so parallel fork workers don't
// fight over the same SQLite file.
JWT_SECRET: 'test-secret-32-chars-padding-here',
NODE_ENV: 'production',
},
// Each test file runs in its own process to get a clean module registry.
// DB_PATH is captured at module load time, so each fork must have its own
// unique path set via process.env BEFORE any import of '../db'.
pool: 'forks',
poolOptions: {
forks: {
singleFork: false,
},
},
},
});