import { defineConfig } from 'vitest/config'; import { fileURLToPath } from 'node:url'; export default defineConfig({ resolve: { alias: { '@': fileURLToPath(new URL('.', import.meta.url)), }, }, test: { environment: 'node', include: ['lib/**/*.test.ts', 'lib/**/*.test.tsx', 'tests/**/*.test.ts'], // Runs before any module is imported, so the Prisma client is built // against the test database rather than the development one. setupFiles: ['tests/setup-database.ts'], // The integration files share one database and each truncates it, so // running files in parallel makes them race. The whole suite is a couple // of seconds; giving every file its own database would buy nothing. fileParallelism: false, coverage: { provider: 'v8', reporter: ['text', 'html', 'lcov'], include: ['lib/**'], exclude: [ 'lib/**/*.test.ts', 'lib/**/*.test.tsx', // Generated by `prisma generate`; not ours to cover. 'lib/generated/**', ], // The business core must stay covered; the CI fails below these. thresholds: { 'lib/schedule/**': { statements: 85, branches: 85, functions: 85, lines: 85 }, 'lib/screen/**': { statements: 85, branches: 85, functions: 85, lines: 85 }, }, }, }, });