forked from promptfoo/promptfoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.integration.config.ts
More file actions
48 lines (41 loc) · 1.16 KB
/
vitest.integration.config.ts
File metadata and controls
48 lines (41 loc) · 1.16 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 os from 'os';
import { defineConfig } from 'vitest/config';
const cpuCount = os.cpus().length;
// Use most cores but leave 2 for system/main process
const maxForks = Math.max(cpuCount - 2, 4);
export default defineConfig({
test: {
deps: {
interopDefault: true,
},
environment: 'node',
exclude: ['**/node_modules/**'],
globals: true,
include: ['**/*.integration.test.ts'],
root: '.',
setupFiles: ['./vitest.setup.ts'],
// Run tests in random order to catch test isolation issues early.
// Tests should not depend on execution order or shared state.
// Override with --sequence.shuffle=false when debugging specific failures.
sequence: {
shuffle: true,
},
// Use forks for better memory isolation
pool: 'forks',
poolOptions: {
forks: {
maxForks,
minForks: 2,
isolate: true,
execArgv: [
'--max-old-space-size=4096', // 4GB per worker for integration tests
],
},
},
// Integration tests may take longer
testTimeout: 60_000, // 60s per test
hookTimeout: 60_000,
teardownTimeout: 15_000,
maxConcurrency: 10,
},
});