-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.config.ts
More file actions
77 lines (75 loc) · 2.34 KB
/
vitest.config.ts
File metadata and controls
77 lines (75 loc) · 2.34 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
import path from 'path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'@': path.resolve(__dirname, './src'),
},
},
esbuild: {
target: 'node20',
},
test: {
globals: true,
environment: 'node',
include: ['src/**/*.test.ts', 'tests/**/*.test.ts'],
exclude: ['node_modules', 'dist', 'vendor', 'templates', 'connectors'],
coverage: {
provider: 'custom',
customProviderModule: './scripts/vitest/coverage-provider.mjs',
reporter: ['text', 'json', 'html', 'lcov'],
// We manage cleaning ourselves in `scripts/quality/clean-coverage.mjs`.
// Vitest's built-in clean can race in some environments when using forks + coverage.
clean: false,
cleanOnRerun: false,
// Explicit scope ensures thresholds are meaningful
include: ['src/**/*.ts'],
exclude: [
'**/*.test.ts',
'**/*.spec.ts',
'tests/**',
'vendor/**',
'templates/**',
'connectors/**',
'dist/**',
'src/**/index.ts',
],
// Overall thresholds - set to current baseline, ratchet up as tests added
thresholds: {
// Baseline as of 2026-02-07 (see `npm run test:coverage`).
// Keep this slightly below current to avoid flakiness while preventing regressions.
lines: 75,
functions: 85,
statements: 75,
branches: 68,
// NOTE: perFile: true deferred until coverage ~70%
// Glob-specific thresholds (enable when ready):
// 'src/core/**': {
// lines: 70,
// functions: 70,
// statements: 70,
// branches: 55,
// },
},
},
testTimeout: 30000,
pool: 'forks',
poolOptions: {
forks: {
// Ensure each test file runs in an isolated worker so `vi.mock()` is reliable and
// global state doesn't leak across the suite (especially under coverage).
isolate: true,
// Stabilize coverage aggregation by using one fork for the whole run.
singleFork: true,
},
},
watch: false,
alias: {
'../errors.js': '../errors.ts',
'../config.js': '../config.ts',
'../logger.js': '../logger.ts',
'../../test/stubs/fake-llm.js': '../../test/stubs/fake-llm.ts',
},
},
});