forked from czlonkowski/n8n-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
77 lines (76 loc) · 2.2 KB
/
vitest.config.ts
File metadata and controls
77 lines (76 loc) · 2.2 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 { defineConfig } from 'vitest/config';
import path from 'path';
export default defineConfig({
test: {
globals: true,
environment: 'node',
// Only include global-setup.ts, remove msw-setup.ts from global setup
setupFiles: ['./tests/setup/global-setup.ts'],
// Load environment variables from .env.test
env: {
NODE_ENV: 'test'
},
// Test execution settings
pool: 'threads',
poolOptions: {
threads: {
singleThread: process.env.TEST_PARALLEL !== 'true',
maxThreads: parseInt(process.env.TEST_MAX_WORKERS || '4', 10),
minThreads: 1
}
},
// Retry configuration
retry: parseInt(process.env.TEST_RETRY_ATTEMPTS || '2', 10),
// Test reporter - reduce reporters in CI to prevent hanging
reporters: process.env.CI ? ['default', 'junit'] : ['default'],
outputFile: {
junit: './test-results/junit.xml'
},
coverage: {
provider: 'v8',
enabled: process.env.FEATURE_TEST_COVERAGE !== 'false',
reporter: process.env.CI ? ['lcov', 'text-summary'] : (process.env.COVERAGE_REPORTER || 'lcov,html,text-summary').split(','),
reportsDirectory: process.env.COVERAGE_DIR || './coverage',
exclude: [
'node_modules/',
'tests/',
'**/*.d.ts',
'**/*.test.ts',
'**/*.spec.ts',
'scripts/',
'dist/',
'**/test-*.ts',
'**/mock-*.ts',
'**/__mocks__/**'
],
thresholds: {
lines: 80,
functions: 80,
branches: 75,
statements: 80
},
// Add coverage-specific settings to prevent hanging
all: false, // Don't collect coverage for untested files
skipFull: true // Skip files with 100% coverage
},
// Test isolation
isolate: true,
// Force exit after tests complete in CI to prevent hanging
forceRerunTriggers: ['**/tests/**/*.ts'],
teardownTimeout: 1000
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@tests': path.resolve(__dirname, './tests')
}
},
// TypeScript configuration
esbuild: {
target: 'node18'
},
// Define global constants
define: {
'process.env.TEST_ENVIRONMENT': JSON.stringify('true')
}
});