Repository navigation
Expand file tree
/
Copy pathvitest.config.ts
More file actions
90 lines (87 loc) · 3.35 KB
/
Copy pathvitest.config.ts
File metadata and controls
90 lines (87 loc) · 3.35 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
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";
const rootDirectory = import.meta.dirname;
export default defineConfig({
plugins: [react()],
// Pin the Vite cache to the workspace root so a per-package Vite sub-context
// (triggered when a colocated spec resolves packages/<pkg>/vite.config.ts)
// cannot create a stray node_modules/.vite cache under that package's src/.
cacheDir: resolve(rootDirectory, "node_modules/.vite"),
resolve: {
alias: {
"@vef-framework-react/calendar": resolve(rootDirectory, "./packages/calendar/src"),
"@vef-framework-react/shared": resolve(rootDirectory, "./packages/shared/src"),
"@vef-framework-react/hooks": resolve(rootDirectory, "./packages/hooks/src"),
"@vef-framework-react/core": resolve(rootDirectory, "./packages/core/src"),
"@vef-framework-react/components": resolve(rootDirectory, "./packages/components/src")
},
conditions: ["vef", "source", "module", "import", "browser", "development"]
},
test: {
name: "vef-framework",
include: ["./packages/**/*.test.{ts,tsx}"],
environment: "jsdom",
setupFiles: ["./scripts/test-setup.ts"],
globals: true,
// Default 5s is too tight for jsdom + react-query + antd specs under
// parallel-worker load — first render in a fresh worker can spend most
// of its budget on per-worker setup before the assertion runs. Bumped
// to 15s so legitimate sync tests aren't killed by infra contention.
testTimeout: 15_000,
coverage: {
provider: "v8",
reporter: ["text", "html", "lcov", "json-summary"],
reportOnFailure: true,
exclude: [
// Package-level barrel and core module-level barrels (re-exports only)
"packages/*/src/index.ts",
"packages/*/src/index.tsx",
"packages/core/src/*/index.ts",
// Type-only and style-only files
"**/types.ts",
"**/styles.ts",
// Specs and test utilities
"**/*.test.{ts,tsx}",
"**/test-utils.tsx",
// Out-of-scope packages (see AGENTS.md > Testing Conventions > What Not to Test)
"packages/starter/**",
"packages/dev/**",
"packages/approval-flow-editor/**",
"plugins/**",
"playground/**",
"scripts/**",
// Build outputs and dependencies
"**/dist/**",
"**/node_modules/**"
],
// Package-level thresholds. Initial values set to (measured baseline - ~5% buffer)
// and will be raised stage by stage as new specs land. Components has no
// package-level threshold: must-test components are tracked in the testing plan.
thresholds: {
"packages/shared/**": {
statements: 85,
branches: 85,
functions: 80,
lines: 85
},
// hooks branches stays at 30: untested deprioritized hooks
// (use-chart/use-data-options/use-upload/use-deep) hold the aggregate
// at ~35%, so 30 leaves the standard ~5% buffer. Other axes have more
// headroom and are tightened here.
"packages/hooks/**": {
statements: 48,
branches: 30,
functions: 65,
lines: 48
},
"packages/core/**": {
statements: 75,
branches: 60,
functions: 75,
lines: 75
}
}
}
}
});