-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy path.vitestrc.coverage.ts
More file actions
131 lines (116 loc) · 2.92 KB
/
.vitestrc.coverage.ts
File metadata and controls
131 lines (116 loc) · 2.92 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'
// Enhanced coverage configuration
export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./vitest.setup.ts'],
include: [
'spec/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
],
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/angular/**',
'**/react/**',
'**/demo/**'
],
// Enhanced coverage configuration for detailed reporting
coverage: {
provider: 'v8',
reporter: [
'text',
'text-summary',
'json',
'json-summary',
'html',
'lcov',
'clover',
'cobertura'
],
// Comprehensive exclusion patterns
exclude: [
'coverage/**',
'dist/**',
'node_modules/**',
'demo/**',
'angular/**',
'react/**',
'scripts/**',
'spec/e2e/**',
'**/*.d.ts',
'**/*.config.{js,ts}',
'**/karma.conf.js',
'**/vitest.config.ts',
'**/vitest.setup.ts',
'**/webpack.config.js',
'**/Gruntfile.js',
'**/*.min.js',
'**/test.html'
],
// Include all source files for coverage analysis
all: true,
include: ['src/**/*.{js,ts}'],
// Strict coverage thresholds
thresholds: {
global: {
branches: 85,
functions: 85,
lines: 85,
statements: 85
},
// Per-file thresholds for critical files
'src/gridstack.ts': {
branches: 90,
functions: 90,
lines: 90,
statements: 90
},
'src/gridstack-engine.ts': {
branches: 90,
functions: 90,
lines: 90,
statements: 90
},
'src/utils.ts': {
branches: 85,
functions: 85,
lines: 85,
statements: 85
}
},
// Coverage report directory
reportsDirectory: './coverage',
// Enable branch coverage
reportOnFailure: true,
// Clean coverage directory before each run
clean: true,
// Skip files with no coverage
skipFull: false,
// Enable source map support for accurate line mapping
allowExternal: false,
// Watermarks for coverage coloring
watermarks: {
statements: [50, 80],
functions: [50, 80],
branches: [50, 80],
lines: [50, 80]
}
},
// Enhanced reporter configuration
reporter: [
'verbose',
'html',
'json',
'junit'
],
// Output files for CI/CD integration
outputFile: {
html: './coverage/test-results.html',
json: './coverage/test-results.json',
junit: './coverage/junit-report.xml'
}
}
})