-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.ts
More file actions
111 lines (97 loc) · 2.59 KB
/
vitest.config.ts
File metadata and controls
111 lines (97 loc) · 2.59 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'url';
export default defineConfig({
test: {
// Test environment
environment: 'node',
globals: true,
// Test timeouts
testTimeout: 10000, // 10s default timeout
hookTimeout: 30000, // 30s for hooks
teardownTimeout: 60000, // 60s for teardown
// Watch mode
watch: false,
// Test reporters
reporters: ['default'],
// Test coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
reportsDirectory: './coverage',
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/coverage/**',
'**/.{idea,git,cache,output,temp}/**',
'**/*.d.ts',
'**/test{,s}/**',
'**/__{test,mock}s__/**',
'**/*.config.{js,ts}',
'**/vitest.{workspace,projects}.{js,ts}'
],
thresholds: {
lines: 80,
functions: 80,
branches: 80,
statements: 80
}
},
// Test file matching
include: process.env.INTEGRATION_TESTS === 'true'
? ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
: [
'tests/**/*.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'src/**/tests/**/*.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
],
// Environment variables
env: {
NODE_ENV: 'test',
MCP_DEBUG: 'false',
MCP_PORT: process.env.MCP_PORT || '4101',
MCP_HOST: process.env.MCP_HOST || 'localhost',
MCP_URL: process.env.MCP_URL || ''
},
// Global setup files
setupFiles: ['./tests/setup-unified.js'],
// TypeScript support
typecheck: {
include: ['**/*.test-d.ts']
},
// Isolate tests for better reliability
isolate: true,
// Enable test retries
retry: 2,
// Test output settings
logHeapUsage: true,
logHeapUsageThreshold: 1024 * 1024, // 1MB
// Watch mode settings
watchExclude: [
'**/node_modules/**',
'**/dist/**',
'**/.git/**'
],
exclude: process.env.INTEGRATION_TESTS === 'true'
? [
'**/node_modules/**',
'**/dist/**',
'**/.git/**',
'**/coverage/**'
]
: [
'**/node_modules/**',
'**/dist/**',
'**/.git/**',
'**/coverage/**',
'tests/integration/**',
'**/e2e/**',
'**/*.e2e.*'
]
},
// Resolve configuration
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@tests': fileURLToPath(new URL('./tests', import.meta.url))
}
}
});