test: add coverage reporting with regression thresholds
Add v8 coverage via a test:coverage script and vitest config: measure src only, exclude the types-only deps.ts and the bin entrypoint main.ts, and gate on ratcheted thresholds (statements 85, branches 78, functions 90, lines 85) set just under current coverage. CI runs the unit+integration tier through coverage so a real drop fails the build.
This commit is contained in:
@@ -6,5 +6,28 @@ export default defineConfig({
|
||||
// tier under test/e2e needs a live Gitea instance and runs via `test:e2e`.
|
||||
include: ["test/**/*.test.ts"],
|
||||
exclude: ["test/e2e/**"],
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
reporter: ["text", "html", "lcov"],
|
||||
// Measure the shipped source only; the CLI is exercised through its seam,
|
||||
// so coverage reflects what those tiers actually reach.
|
||||
include: ["src/**/*.ts"],
|
||||
exclude: [
|
||||
// Types-only: no runtime code to exercise.
|
||||
"src/deps.ts",
|
||||
// Bin entrypoint: process argv/stdout/EPIPE wiring that delegates to the
|
||||
// covered runCli seam; not reached by the in-process seam tests.
|
||||
"src/main.ts",
|
||||
],
|
||||
// A regression ratchet, not a target: set a few points under current
|
||||
// coverage so a real drop fails CI while trivial churn does not. Raise
|
||||
// these as coverage climbs; never lower them to make a red build pass.
|
||||
thresholds: {
|
||||
statements: 85,
|
||||
branches: 78,
|
||||
functions: 90,
|
||||
lines: 85,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user