Expand file tree
/
Copy pathvitest.config.ts
More file actions
169 lines (158 loc) · 5.84 KB
/
Copy pathvitest.config.ts
File metadata and controls
169 lines (158 loc) · 5.84 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { coverageConfigDefaults, defineConfig } from "vitest/config";
// Shared exclusions for all projects
// Ref: https://vitest.dev/config/#exclude
const vitestDefaultExcludes = [
"**/node_modules/**",
"**/dist/**",
"**/cypress/**",
"**/.{idea,git,cache,output,temp}/**",
// Agent worktrees contain full repo copies whose tests would otherwise be
// picked up by the unanchored include globs and race over fixed ports.
"**/.claude/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
];
const NON_UNIT_PACKAGES = [
"packages/accuracy-tests/**",
"packages/browser-tests/**",
"packages/eval-tests/**",
"packages/integration-tests/**",
"packages/scripts/**",
"packages/ui/**",
];
const UNIT_INCLUDES = ["packages/*/src/**/*.test.ts"];
const INTEGRATION_ATLAS_INCLUDES = ["packages/integration-tests/src/tools/atlas/**/*.test.ts"];
const ATLAS_STREAMS_TESTS = ["packages/integration-tests/src/tools/atlas/streams/**/*.test.ts"];
const ATLAS_CLUSTER_TESTS = [
"packages/integration-tests/src/tools/atlas/clusters.test.ts",
"packages/integration-tests/src/tools/atlas/sampleDataset.test.ts",
];
const INTEGRATION_ATLAS_LOCAL_INCLUDES = ["packages/integration-tests/src/tools/atlas-local/**/*.test.ts"];
const INTEGRATION_INCLUDES = ["packages/integration-tests/src/**/*.test.ts"];
const INTEGRATION_ATLAS_EXCLUDES = [
...INTEGRATION_ATLAS_INCLUDES,
...INTEGRATION_ATLAS_LOCAL_INCLUDES,
...ATLAS_STREAMS_TESTS,
...ATLAS_CLUSTER_TESTS,
];
const LONG_RUNNING_TESTS = ["packages/integration-tests/src/tools/atlas/performanceAdvisor.test.ts"];
export default defineConfig({
test: {
environment: "node",
testTimeout: 3600000,
hookTimeout: 3600000,
setupFiles: ["./packages/test-utils/src/setup.ts"],
coverage: {
// Coverage is disabled on Windows as we only report it from the ubuntu job
enabled: process.platform !== "win32",
exclude: [
// Required: import.meta.glob() in src/ui creates Vite virtual modules (\0 prefixed paths)
// that crash Istanbul reporters. See: https://github.com/vitest-dev/vitest/issues/5101
...coverageConfigDefaults.exclude,
"node_modules",
"dist",
"vitest.config.ts",
"packages/scripts/src",
"packages/mongodb-mcp-server/dist",
],
reporter: ["lcov"],
},
projects: [
{
extends: true,
test: {
name: "unit",
include: UNIT_INCLUDES,
exclude: [...vitestDefaultExcludes, ...NON_UNIT_PACKAGES],
},
},
{
extends: true,
test: {
name: "integration",
include: INTEGRATION_INCLUDES,
exclude: [...vitestDefaultExcludes, ...INTEGRATION_ATLAS_EXCLUDES, ...LONG_RUNNING_TESTS],
},
},
{
extends: true,
test: {
name: "integration-atlas",
include: INTEGRATION_ATLAS_INCLUDES,
exclude: [
...vitestDefaultExcludes,
...ATLAS_STREAMS_TESTS,
...ATLAS_CLUSTER_TESTS,
...LONG_RUNNING_TESTS,
],
},
},
{
extends: true,
test: {
name: "clusters-tests",
include: [...ATLAS_CLUSTER_TESTS],
testTimeout: 7200000, // 2 hours for long-running tests
hookTimeout: 7200000,
},
},
{
extends: true,
test: {
name: "streams-tests",
include: ATLAS_STREAMS_TESTS,
testTimeout: 7200000, // 2 hours for long-running tests
hookTimeout: 7200000,
globalSetup: ["./packages/integration-tests/src/tools/atlas/streamsGlobalSetup.ts"],
fileParallelism: false,
},
},
{
extends: true,
test: {
name: "integration-atlas-local",
include: INTEGRATION_ATLAS_LOCAL_INCLUDES,
exclude: [...vitestDefaultExcludes],
},
},
{
extends: true,
test: {
name: "long-running-tests",
include: [...LONG_RUNNING_TESTS],
testTimeout: 7200000, // 2 hours for long-running tests
hookTimeout: 7200000,
},
},
{
extends: true,
test: {
name: "accuracy",
include: ["packages/accuracy-tests/src/**/*.test.ts"],
},
},
{
extends: true,
test: {
name: "eslint-rules",
include: ["eslint-rules/*.test.js"],
},
},
{
extends: true,
test: {
name: "atlas-cleanup",
include: ["packages/scripts/src/cleanupAtlasTestLeftovers.test.ts"],
},
},
{
test: {
name: "ui",
root: "./packages/ui",
environment: "happy-dom",
setupFiles: ["./src/test-setup.ts"],
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
},
},
],
},
});