-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
55 lines (53 loc) · 2.31 KB
/
Copy pathvitest.config.ts
File metadata and controls
55 lines (53 loc) · 2.31 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
import {defineConfig} from 'vitest/config';
// Per-package 100% coverage gate, one glob group per package. Vitest 4 removed
// `defineWorkspace` (the old vitest.workspace.ts was silently inert — WR-0532), and
// coverage is a ROOT-ONLY concern under `test.projects`: the `coverage.thresholds`
// blocks in packages/*/vitest.config.ts are ignored on the root run (verified
// empirically 2026-07-22 — an uncovered branch in packages/helpers exited 0 with
// projects loaded). Each glob key below is an independent threshold group, so a dip
// in one package fails the gate by name instead of drowning in a fleet aggregate.
// The per-package config blocks stay load-bearing for in-package runs (Stryker's
// vitest runner + `vitest run` from a package dir).
const PACKAGE_THRESHOLDS = Object.fromEntries(
[
'adapter-store',
'cached-adapter-store',
'dialog',
'form',
'helpers',
'http',
'loading',
'router',
'storage',
'theme',
'toast',
'translation',
'ui-inputs',
].map((pkg) => [`packages/${pkg}/src/**`, {lines: 100, branches: 100, functions: 100, statements: 100}]),
);
export default defineConfig({
test: {
// vitest 4 project discovery (replaces the removed defineWorkspace):
// each packages/* dir contributes its own vitest.config.ts as a project
// config — including the ui-inputs Vue plugin (SFC transform) and its
// tests/browser exclusion. The glob is root-anchored, so full repo
// copies under .claude/ agent worktrees are never swept in as projects.
projects: ['packages/*'],
coverage: {
provider: 'v8',
// Explicit include so a src file no spec ever imports still counts
// (0%) instead of silently escaping the gate.
include: ['packages/*/src/**/*.{ts,vue}'],
thresholds: {
...PACKAGE_THRESHOLDS,
// Global backstop: a future package added without a glob entry
// above falls into this group and still faces the 100% bar
// (files matched by the globs are subtracted from this group).
lines: 100,
branches: 100,
functions: 100,
statements: 100,
},
},
},
});