-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.js
More file actions
60 lines (50 loc) · 1.62 KB
/
Copy pathvitest.config.js
File metadata and controls
60 lines (50 loc) · 1.62 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
import { defineConfig } from 'vitest/config'
import { loadEnv } from 'vite'
export default defineConfig(({ mode }) => ({
test: {
// Test environment - using Node.js native environment for our MCP server
environment: 'node',
// Global test configuration
globals: false, // We'll import test functions explicitly for better IDE support
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
include: ['src/**/*.{js,ts}'],
exclude: [
'tests/**',
'dev-server.js',
'scripts/**',
'**/*.config.{js,ts}',
'bin/**'
]
},
// Mock configuration
clearMocks: true, // Clear mock call history before each test
restoreMocks: true, // Restore original implementations after each test
// Test file patterns
include: ['tests/**/*.{test,spec}.{js,ts}'],
exclude: [
'node_modules/**',
'dist/**',
'**/*.d.ts'
],
// Test timeout (30 seconds for integration tests with real API calls)
testTimeout: 30000,
hookTimeout: 30000,
// Parallel execution for faster test runs
pool: 'threads',
maxWorkers: 4,
// Reporter configuration
reporters: ['verbose'],
// Setup files for test utilities and global configuration
setupFiles: [],
// Environment variables for testing
// Load all env vars from .env files (empty prefix loads all, not just VITE_)
env: {
...loadEnv(mode ?? 'test', process.cwd(), ''),
NODE_ENV: 'test',
LOG_LEVEL: 'error' // Suppress logs during testing
}
}
}))