From 9a97f5c8ccbff4b736694b96b50b53c7b5a9a081 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Mon, 13 Jul 2026 02:35:51 -0700 Subject: [PATCH] test(miner-ui): bring the miner-ui under a real coverage gate Adds vitest coverage config (v8 provider) with thresholds set at the measured baseline (~87/87/79/89), enforced via `npm test --coverage`. Verified the gate genuinely fails on a regression (temporarily raised a threshold above the real number, confirmed the run fails, reverted). Extension coverage (the other half of #4865) needs its own test suite built first -- no vitest setup exists there yet -- left for a follow-up. --- apps/gittensory-miner-ui/README.md | 8 ++++++++ apps/gittensory-miner-ui/package.json | 2 +- apps/gittensory-miner-ui/vitest.config.ts | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/gittensory-miner-ui/README.md b/apps/gittensory-miner-ui/README.md index 531508c01..adef2eadc 100644 --- a/apps/gittensory-miner-ui/README.md +++ b/apps/gittensory-miner-ui/README.md @@ -40,3 +40,11 @@ the repo root is a ready-to-adapt persistent unit for this — a companion to `gittensory-miner.service.example` (the loop daemon), not a replacement for it. Its header comment carries the full install steps. Like the loop daemon, this is a `Type=simple` service, not a `.timer` job — the dashboard is a long-running HTTP server, not a periodic batch task. + +## Test coverage + +`npm test` runs with `--coverage` enabled (v8 provider) and enforces `vitest.config.ts`'s `coverage.thresholds` +— a real measured baseline (#4865), not an aspirational target, so CI fails on a genuine regression (e.g. a +large new feature landing with no tests) rather than staying silently unmeasured the way `apps/**` is by +default at the repo root. `apps/gittensory-miner-extension` is not yet under this gate — its own test +instrumentation needs to exist first (see #4865's own scope note). diff --git a/apps/gittensory-miner-ui/package.json b/apps/gittensory-miner-ui/package.json index e9ae66bb2..2aa694c01 100644 --- a/apps/gittensory-miner-ui/package.json +++ b/apps/gittensory-miner-ui/package.json @@ -11,7 +11,7 @@ "preview": "vite preview", "typecheck": "tsc --noEmit", "lint": "eslint .", - "test": "vitest run", + "test": "vitest run --coverage", "format": "prettier --write ." }, "dependencies": { diff --git a/apps/gittensory-miner-ui/vitest.config.ts b/apps/gittensory-miner-ui/vitest.config.ts index 77e087179..24419dc28 100644 --- a/apps/gittensory-miner-ui/vitest.config.ts +++ b/apps/gittensory-miner-ui/vitest.config.ts @@ -8,5 +8,22 @@ export default defineConfig({ environment: "jsdom", globals: true, include: ["src/**/*.test.{ts,tsx}"], + coverage: { + provider: "v8", + include: ["src/**/*.{ts,tsx}", "vite-*.ts"], + exclude: ["src/routeTree.gen.ts", "src/main.tsx"], + reporter: ["text", "lcov"], + // A real baseline (#4865), not an aspirational target: measured at ~87.65/87.17/78.9/88.79 the day this + // was wired up, with a few points of buffer below that so routine formatting/refactor churn doesn't + // false-fail. This is a floor meant to catch a genuine regression (a big untested addition), not a + // ratchet — raise it incrementally as more of the pre-existing gaps (the three sibling API plugins' + // own middleware-wiring layer, __root.tsx's nav shell) get covered over time, per-PR, not in one sweep. + thresholds: { + statements: 85, + branches: 85, + functions: 75, + lines: 85, + }, + }, }, });