forked from PalisadoesFoundation/talawa-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
68 lines (66 loc) · 2.09 KB
/
vitest.config.ts
File metadata and controls
68 lines (66 loc) · 2.09 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import svgrPlugin from 'vite-plugin-svgr';
const isCI = !!process.env.CI;
export default defineConfig({
plugins: [react(), tsconfigPaths(), svgrPlugin()],
build: {
sourcemap: false, // Disable sourcemaps for faster tests
},
esbuild: {
sourcemap: false, // Disable sourcemaps for faster tests
},
test: {
include: ['src/**/*.{spec,test}.{js,jsx,ts,tsx}'],
globals: true,
environment: 'jsdom',
setupFiles: 'vitest.setup.ts',
testTimeout: 30000,
hookTimeout: 10000,
teardownTimeout: 10000,
// Use threads for better performance in CI
pool: 'threads',
poolOptions: {
threads: {
singleThread: false,
minThreads: 1,
maxThreads: isCI ? 2 : 4, // Conservative in CI to avoid OOM
// Keep isolation enabled to prevent test interference
isolate: true,
},
},
// Lower concurrency in CI to avoid memory issues
maxConcurrency: isCI ? 1 : 2,
// Enable file parallelism for better performance
fileParallelism: true,
sequence: {
shuffle: false,
concurrent: false, // Disabled for test stability - files still run in parallel across shards
},
coverage: {
enabled: true,
provider: 'istanbul',
reportsDirectory: './coverage/vitest',
// Don't use 'all: true' with sharding - let merge handle combining partial coverage
exclude: [
'node_modules',
'dist',
'docs/**',
'**/*.{spec,test}.{js,jsx,ts,tsx}',
'coverage/**',
'**/index.{js,ts}',
'**/*.d.ts',
'src/test/**',
'vitest.config.ts',
'vitest.setup.ts',
'cypress/**',
'cypress.config.ts',
'.github/**', // Exclude GitHub workflows and scripts
'scripts/**', // Exclude build/setup scripts
'config/**', // Exclude configuration files
],
reporter: ['lcov', 'json', 'text', 'text-summary'], // Use json for accurate merging, lcov for final report
},
},
});