-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.real-api.config.js
More file actions
62 lines (50 loc) · 1.6 KB
/
vitest.real-api.config.js
File metadata and controls
62 lines (50 loc) · 1.6 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
import { defineConfig } from 'vitest/config'
import { loadEnv } from 'vite'
import { getTestConfig } from './tests/suites.config.js'
const suiteConfig = getTestConfig('real-api')
export default defineConfig(({ mode }) => {
// Load environment variables based on mode (test mode loads .env.test)
const env = loadEnv(mode || 'test', process.cwd(), '')
return {
test: {
// Test environment
environment: 'node',
// Test file patterns - real API tests only
include: suiteConfig.test.include,
exclude: suiteConfig.test.exclude,
// Timeout configuration - longer for real API calls
testTimeout: suiteConfig.test.testTimeout,
hookTimeout: 30000,
// Coverage configuration - relaxed for real API tests
coverage: {
provider: 'v8',
reporter: ['text', 'json'],
include: ['src/**/*.{js,ts}'],
exclude: [
'tests/**',
'dev-server.js',
'scripts/**',
'**/*.config.{js,ts}',
'bin/**'
]
},
// Mock configuration
clearMocks: true,
restoreMocks: true,
// Sequential execution for real API tests to avoid rate limiting
pool: 'threads',
maxWorkers: 1,
// Reporter configuration
reporters: ['verbose'],
// Environment variables - properly loaded from .env.test
env: {
...suiteConfig.test.env,
...env
},
// Setup files
setupFiles: suiteConfig.test.setupFiles,
// Retry configuration for flaky API tests
retry: 1
}
}
})