Skip to content

Commit edc498d

Browse files
Merge pull request #26 from offendingcommit/chore/vitest-coverage
test(web): add v8 coverage with truthful baseline floor
2 parents 8e16dc4 + 94c4235 commit edc498d

6 files changed

Lines changed: 176 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ packages/desktop/src-tauri/gen/
4444

4545
# Drafts from scripts/pr-evidence.sh
4646
PR_BODY.md
47+
48+
# Test coverage
49+
coverage

packages/web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"lint": "biome check src/",
1111
"lint:fix": "biome check --write src/",
1212
"test": "vitest run --passWithNoTests",
13+
"test:coverage": "vitest run --coverage",
1314
"test:e2e": "playwright test",
1415
"generate:api": "openapi-typescript openapi.json -o src/api/schema.d.ts"
1516
},
@@ -54,6 +55,7 @@
5455
"@types/react": "catalog:",
5556
"@types/react-dom": "catalog:",
5657
"@vitejs/plugin-react": "catalog:",
58+
"@vitest/coverage-v8": "catalog:",
5759
"jsdom": "catalog:",
5860
"openapi-typescript": "^7.8.0",
5961
"typescript": "catalog:",

packages/web/vitest.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,26 @@ export default defineConfig({
2222
css: false,
2323
include: ["src/**/*.{test,spec}.{ts,tsx}"],
2424
exclude: ["node_modules", "dist", "e2e"],
25+
coverage: {
26+
provider: "v8",
27+
reporter: ["text", "html", "json-summary", "lcov"],
28+
include: ["src/**/*.{ts,tsx}"],
29+
exclude: [
30+
"src/**/*.{test,spec}.{ts,tsx}",
31+
"src/test/**",
32+
"src/routeTree.gen.ts",
33+
"src/api/schema.d.ts",
34+
"src/main.tsx",
35+
"src/vite-env.d.ts",
36+
],
37+
// Truthful baseline floor measured on main (not copied from the
38+
// fork). Ratchet upward as feature tests grow.
39+
thresholds: {
40+
lines: 18,
41+
functions: 10,
42+
branches: 10,
43+
statements: 17,
44+
},
45+
},
2546
},
2647
});

0 commit comments

Comments
 (0)