-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
49 lines (41 loc) · 1.38 KB
/
vitest.config.ts
File metadata and controls
49 lines (41 loc) · 1.38 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
import { coverageConfigDefaults, defineConfig } from 'vitest/config';
export default defineConfig({
test: {
// Test environment (browser simulation)
environment: 'happy-dom',
// Setup files (fake-indexeddb polyfill)
setupFiles: ['./tests/setup.ts'],
// Test file patterns
include: ['tests/**/*.{test,spec}.ts'],
exclude: ['**/node_modules/**', 'dist'],
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
reportsDirectory: './coverage',
include: ['src/**/*.ts'],
exclude: [...coverageConfigDefaults.exclude, 'src/**/index.ts', '**/*.test.ts'],
// Coverage thresholds: High coverage with realistic browser API testing limits
// Note: Some browser-specific APIs (getComputedStyle, scroll behavior, media queries)
// don't fully work in jsdom/happy-dom, causing uncovered branches.
// Function coverage is 99% because V8 counts internal lambda callbacks as separate
// functions - these are covered by statement/line coverage.
thresholds: {
lines: 99,
functions: 99,
branches: 95,
statements: 99,
},
},
// Test output
reporters: ['verbose'],
// Performance
globals: true,
mockReset: true,
restoreMocks: true,
clearMocks: true,
// Timeouts
testTimeout: 5000,
hookTimeout: 5000,
},
});