-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
118 lines (115 loc) · 4.41 KB
/
Copy pathvitest.config.ts
File metadata and controls
118 lines (115 loc) · 4.41 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
import { defineConfig } from "vitest/config";
import { createRepoVitestAliases } from "./vitest.aliases";
// Single source of truth for the whole repo's test run. Two projects split the
// suite by environment: `node` for backend/lib code, `web` (jsdom) for the
// Next.js app and the React-bound packages. Scope a run with
// `pnpm test --project web` / `--project node`, or filter by path/name
// (`pnpm vitest run <substring>`). There are intentionally no per-package
// vitest configs — this file owns discovery for every workspace.
const alias = createRepoVitestAliases(__dirname);
// Shared by both projects: workspace import aliases + global test APIs, plus the
// @mui/material inline. MUI 9.1.0 vendored its own Transition whose .mjs build
// imports `react-transition-group/TransitionGroupContext` as a bare,
// extensionless subpath; react-transition-group 4.4.5 ships no `exports` map, so
// Node's native ESM loader rejects it while vite's resolver handles it. Inlining
// MUI routes the import through vite, matching production resolution.
const shared = {
resolve: { alias },
test: {
globals: true,
// 5s (the default) is too tight under full-suite CPU saturation for the
// legitimately slow tests — real crypto KDFs (mangrove-react keypair
// decrypt) and the conformance test's 84 per-integration dynamic imports.
// 15s keeps headroom while still catching a genuine hang.
testTimeout: 15_000,
server: { deps: { inline: [/@mui\/material/] } },
},
};
export default defineConfig({
test: {
// Collected non-gating in CI for now (no thresholds) to establish an honest
// repo-wide baseline; gate later. `include` spans real source only.
coverage: {
provider: "v8",
reporter: ["text", "html"],
include: [
"apps/*/src/**",
"packages/*/src/**",
"packages/*/*.ts",
"integrations/**",
"services/data-manager/**",
],
exclude: [
"**/node_modules/**",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.d.ts",
"**/__tests__/**",
"**/test/**",
"**/*.config.*",
"**/types.ts",
"**/types/**",
],
},
projects: [
{
...shared,
test: {
...shared.test,
name: "node",
environment: "node",
setupFiles: ["./vitest.setup.node.ts"],
include: [
"apps/api/src/**/*.test.ts",
"apps/api/scripts/**/*.test.ts",
"apps/ops-agent/src/**/*.test.ts",
"apps/transitous-runner/src/**/*.test.ts",
// Mobile Node-side config/plugin tests only. React Native component
// and coordinator tests run under `apps/mobile`'s own jest-expo
// project, which neither Vitest environment can host.
"apps/mobile/config/**/*.test.ts",
"apps/mobile/plugins/**/*.test.ts",
"apps/mobile/scripts/**/*.test.ts",
"apps/mobile/qa/**/*.test.ts",
"apps/mobile/release/**/*.test.ts",
"apps/mobile/compliance/**/*.test.ts",
"apps/mobile/store/**/*.test.ts",
"integrations/**/*.test.ts",
"packages/**/*.test.ts",
"scripts/**/*.test.ts",
"services/dawarich-app/**/*.test.ts",
"services/dawarich-sidekiq/**/*.test.ts",
"services/data-manager/**/*.test.ts",
"services/motis-feed-proxy/**/*.test.ts",
],
// jsdom-owned paths run in the `web` project below — exclude here so
// they don't run twice.
exclude: [
"**/node_modules/**",
"packages/core/src/hooks/**",
"packages/mangrove-react/**",
],
},
},
{
...shared,
test: {
...shared.test,
name: "web",
environment: "jsdom",
setupFiles: ["./apps/web/src/test/setup.ts"],
include: [
"apps/web/src/**/*.test.ts?(x)",
"packages/core/src/hooks/**/*.test.ts?(x)",
"packages/mangrove-react/**/*.test.ts?(x)",
// Integration map-layer/legend components render React against jsdom
// and import the web app's `@/*` aliases, so they belong here rather
// than in the plain-node `integrations/**/*.test.ts` suite above.
"integrations/**/*.test.tsx",
],
exclude: ["**/node_modules/**"],
},
},
],
},
});