Repository navigation
Expand file tree
/
Copy pathvitest.config.js
More file actions
86 lines (73 loc) · 2.17 KB
/
Copy pathvitest.config.js
File metadata and controls
86 lines (73 loc) · 2.17 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
import { defineConfig } from "vitest/config";
import { fileURLToPath } from "url";
import { resolve, dirname } from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig({
test: {
// Test environment
environment: "node",
// File patterns to test
include: ["**/tests/**/*.test.js", "**/tests/**/*.spec.js"],
exclude: ["node_modules/**", ".claude/**"],
// Test timeout
testTimeout: 10000,
// Global setup
setupFiles: ["./tests/setup.js"],
// Coverage configuration
coverage: {
enabled: true,
provider: "v8",
reporter: ["text", "lcov", "html"],
reportsDirectory: "./coverage",
threshold: {
global: {
statements: 10,
branches: 50,
functions: 15,
lines: 10,
},
},
include: ["src/**/*.js"],
exclude: [
"node_modules/**",
"tests/**",
"src/index.js",
"src/config/**",
"**/*.d.ts",
],
},
// Globals (allows using describe, it, expect without imports)
globals: false, // Explicit imports for clarity
// Watch mode options
watch: false,
// Output configuration
reporter: ["verbose"], // Options: "verbose" (default), "dot", "json", "junit", "hanging-process"
// Use "verbose" for detailed output, "dot" for minimal dots, "json" for JSON format
// Suppress stdout during tests (stderr/errors still shown)
onConsoleLog(log, type) {
if (type === "stdout") {
return false; // Suppress all stdout messages
}
return true; // Keep stderr/errors
},
// Pool options to reduce worker termination issues
// Using threads instead of forks to avoid EPERM errors on macOS
pool: "threads",
poolOptions: {
threads: {
singleThread: false,
isolate: true,
},
},
// Suppress console output during tests (errors are still caught)
silent: false, // Keep false, use onConsoleLog above to filter stdout
// Log configuration
logHeapUsage: false,
},
resolve: {
alias: {
"^src/(.*)$": resolve(__dirname, "./src/$1"),
},
},
});