-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
78 lines (77 loc) · 2.54 KB
/
Copy pathvitest.config.mts
File metadata and controls
78 lines (77 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineConfig } from "vitest/config"
import react from "@vitejs/plugin-react"
import tsconfigPaths from "vite-tsconfig-paths"
export default defineConfig({
plugins: [tsconfigPaths(), react()],
test: {
environment: "jsdom",
setupFiles: "./vitest.setup.ts",
globals: true,
include: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
exclude: ["**/node_modules/**", "**/dist/**", "**/e2e/**", "tests/db/**", ".next/**"],
coverage: {
reporter: ["text", "json", "html"],
// IMPORTANT: These thresholds are ENFORCED in CI (see .github/workflows/ci.yml)
// Any PR that reduces coverage below these levels will fail the build
thresholds: {
// Global thresholds: Set to current baseline to prevent regression
// Target: Incrementally increase to 75% statements as B4-B9 tests are added
// Last updated: 2026-02-12 (baseline: 53.97% statements, 82.21% branches)
global: {
branches: 80, // Current: 82.21%, set to 80 to allow minor variation
functions: 80, // Current: 82.12%, set to 80 to allow minor variation
lines: 50, // Current: 53.97%, set to 50 to prevent major regression
statements: 50, // Current: 53.97%, set to 50 to prevent major regression
},
// Per-file thresholds for critical paths (higher standards)
"lib/search/**": {
statements: 90, // Critical search logic requires high coverage
branches: 85,
},
"lib/eligibility/**": {
statements: 95, // Eligibility logic must be thoroughly tested
},
"lib/ai/**": {
statements: 65, // AI features can be harder to test
},
"hooks/**": {
statements: 75, // Hooks require good coverage
},
},
exclude: [
"node_modules/**",
"dist/**",
".next/**",
"**/*.d.ts",
"tests/**",
// Legitimately untestable via Unit Tests
"scripts/**",
"app/**/page.tsx",
"app/**/layout.tsx",
"proxy.ts",
"*.config.*",
"public/**",
"lp-items.tsx",
"i18n/**",
"app/api/**", // Covered by integration tests mostly
"lib/external/**", // Mocked boundaries
],
},
deps: {
optimizer: {
web: {
include: ["vitest-canvas-mock"],
},
},
},
server: {
deps: {
inline: ["next-intl", "next"],
},
},
alias: {
"next/navigation": "next/navigation.js",
"next/headers": "next/headers.js",
},
},
})