-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.js
More file actions
126 lines (114 loc) · 3.8 KB
/
vitest.config.js
File metadata and controls
126 lines (114 loc) · 3.8 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
/**
* Vitest configuration for Eventide RP System
* Migrated from Jest to Vitest with @rayners/foundry-test-utils
*/
import { defineConfig } from 'vitest/config';
export default defineConfig({
// Test environment - jsdom for FoundryVTT compatibility
test: {
environment: 'jsdom',
// Enable globals (describe, it, expect, etc.)
globals: true,
// Setup files
setupFiles: [
'@rayners/foundry-test-utils/dist/helpers/setup.js',
'./tests/setup.mjs'
],
// Global setup - runs once before all tests
globalSetup: './tests/global-setup.mjs',
// Test file patterns - organized by test type
include: [
'tests/unit/**/*.test.mjs',
'tests/unit/**/*.spec.mjs',
'tests/integration/**/*.test.mjs',
'tests/integration/**/*.spec.mjs',
'tests/e2e/**/*.test.mjs',
'tests/e2e/**/*.spec.mjs'
],
// Exclude patterns
exclude: [
'node_modules/**',
'dist/**',
'coverage/**',
'build/**'
],
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
reportsDirectory: './coverage',
// Collect coverage from these files
include: ['module/**/*.mjs'],
exclude: [
'module/**/*.test.mjs',
'module/**/*.spec.mjs',
'node_modules/**',
// Barrel files - only re-export modules, no testable logic
'module/**/_module.mjs',
// UI sheet mixins - heavy DOM interaction, Foundry Application dependencies
'module/ui/mixins/**/*.mjs',
// Theme helpers - visual styling, low regression risk
'module/helpers/theme/**/*.mjs',
// DOM-heavy UI modules - require integration tests with actual DOM
'module/helpers/color-pickers.mjs',
'module/helpers/number-inputs.mjs',
'module/helpers/range-sliders.mjs',
'module/helpers/tab-container-styling.mjs',
// Foundry hooks - lifecycle callbacks, hard to test in isolation
'module/services/hooks/**/*.mjs',
// Settings registration - configuration code, low test value
'module/services/settings/**/*.mjs',
// UI components - DOM-heavy, require full Foundry UI context
'module/ui/components/**/*.mjs',
// UI creator applications - DOM-heavy, require full Foundry UI context
'module/ui/creators/**/*.mjs',
// UI macro applications - DOM-heavy, require full Foundry UI context
'module/ui/macros/**/*.mjs',
// UI popup applications - DOM-heavy, require full Foundry UI context
'module/ui/popups/**/*.mjs',
// UI sheet applications - DOM-heavy, require full Foundry UI context
'module/ui/sheets/**/*.mjs',
// template helper files - no logic to test
'module/helpers/templates.mjs',
// Main system initialization - bootstrapping code requiring full Foundry lifecycle
'module/eventide-rp-system.mjs'
],
// Coverage thresholds - reasonable initial thresholds
thresholds: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50
},
// Higher thresholds for critical files
'module/documents/mixins/actor-rolls.mjs': {
branches: 70,
functions: 70,
lines: 70,
statements: 70
},
'module/data/base-actor.mjs': {
branches: 70,
functions: 70,
lines: 70,
statements: 70
}
}
},
// Test timeout
testTimeout: 10000,
// Verbose output for debugging
reporters: ['verbose'],
// Clear mocks between tests
clearMocks: true,
restoreMocks: true,
// Pool options for better performance
pool: 'threads',
poolOptions: {
threads: {
singleThread: false
}
}
}
});