-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvitest.config.ts
More file actions
48 lines (38 loc) · 1.35 KB
/
vitest.config.ts
File metadata and controls
48 lines (38 loc) · 1.35 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
import { defineConfig } from 'vitest/config';
export default defineConfig({
esbuild: {
jsx: 'automatic',
target: 'es2020',
},
define: {
'import.meta.vitest': undefined,
},
test: {
// Environment configuration
environment: 'happy-dom', // Use happy-dom for React testing
// Setup files for React
setupFiles: ['./src/__tests__/setup.ts'],
// Test timeout configuration
testTimeout: 10000, // 10 seconds for read operations
hookTimeout: 5000, // 5 seconds for setup/teardown
// Prevent hanging processes
teardownTimeout: 3000,
// Ensure unhandled errors are properly surfaced
dangerouslyIgnoreUnhandledErrors: false,
// Global setup
globals: true,
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: ['node_modules/', 'dist/', '**/*.test.ts', '**/*.spec.ts'],
},
// File patterns - only include our src tests
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
exclude: ['node_modules/**', 'dist/**', '.git/**', '**/node_modules/**'],
// Reporter configuration
reporters: ['verbose'],
// Retry configuration for flaky network tests
retry: 1,
},
});