-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathvitest.config.ts
More file actions
123 lines (111 loc) · 4 KB
/
vitest.config.ts
File metadata and controls
123 lines (111 loc) · 4 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
/**
* Test Isolation Configuration
*
* RESOLUTION: Tests were hanging due to mock dependencies creating shared state.
* This configuration runs only pure unit tests without mocks to ensure:
* - Complete isolation between tests
* - Fast execution (< 3 seconds total)
* - No hanging or timeout issues
*
* Excluded tests require refactoring to remove mock dependencies.
* See docs/test-isolation-solution.md for migration guide.
*
* GitHub Issue: https://github.com/bdougie/contributor.info/issues/299
*/
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
// Complete isolation with React 18 compatibility
isolate: true,
fileParallelism: false,
sequence: {
shuffle: false,
},
// Increased timeouts for complex async tests
testTimeout: 15000,
hookTimeout: 10000,
teardownTimeout: 5000,
// Single thread for stability
pool: 'forks',
poolOptions: {
forks: {
singleFork: true,
isolate: true,
// Ensure each test file runs in its own fork to avoid React conflicts
single: true,
},
},
// No mocks - only DOM cleanup
setupFiles: ['./src/__mocks__/no-mocks-setup.ts'],
// Run all tests including netlify functions and app folder
include: [
'src/**/*.test.ts',
'src/**/*.test.tsx',
'netlify/functions/**/*.test.ts',
'app/**/*.test.ts',
],
// Exclude tests that cause hanging due to mock issues
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/coverage/**',
// Tests that hang due to mock dependencies
'src/__tests__/github-auth-hook.test.tsx',
'src/app/services/__tests__/issue-similarity.test.ts',
'src/app/webhooks/__tests__/issue-comment.test.ts',
'src/components/__tests__/login-required-for-search.test.tsx',
'src/components/features/repository/__tests__/repository-summary-card.test.tsx',
'src/evals/__tests__/evaluation-framework.test.ts',
'src/hooks/__tests__/use-github-api.test.ts',
'src/hooks/__tests__/use-repo-data.test.ts',
'src/hooks/__tests__/use-repo-search.test.ts',
'src/hooks/__tests__/use-repository-discovery.test.ts',
'src/hooks/__tests__/use-repository-summary.test.ts',
// Complex progressive loading tests with timing issues
'src/hooks/__tests__/use-progressive-repo-data.test.ts',
'src/hooks/__tests__/use-intersection-loader.test.ts',
'src/hooks/__tests__/progressive-loading-integration.test.tsx',
'src/hooks/__tests__/progressive-loading-error-boundary.test.tsx',
// Note: Simplified versions are in *-basic.test.ts and *-critical.test.ts files
'src/lib/__tests__/link-capturing.test.ts',
'src/lib/__tests__/yolo-behavior.test.ts',
'src/lib/inngest/functions/__tests__/event-flow.integration.test.ts',
'src/lib/insights/health-metrics.test.ts',
'src/lib/progressive-capture/__tests__/hybrid-queue-manager.test.ts',
// Tests with async patterns added in fix/repository-status-json-response PR
// These tests have been rewritten to use synchronous patterns
// 'src/hooks/__tests__/useWorkspacePRs.test.ts', // Fixed - now synchronous
// 'src/lib/insights/issue-metrics.test.ts', // Fixed - now synchronous
// 'src/lib/spam/__tests__/SpamDetectionService.test.ts', // Fixed - now synchronous
],
// No coverage
coverage: {
enabled: false,
},
// Simple reporter
reporters: ['default'],
// Basic environment
environmentOptions: {
jsdom: {
pretendToBeVisual: true,
},
},
// No threads for stability
threads: false,
maxWorkers: 1,
minWorkers: 1,
maxConcurrency: 1,
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
// Fix relative path resolution for netlify functions
'../../src': resolve(__dirname, './src'),
},
},
});