test: measure coverage in ci (report-only) #5

Sammanfogat
supernaut sammanfogade 1 incheckning från test/coverage in i main 2026-07-29 19:36:41 +00:00
Ägare

Adds @vitest/coverage-v8 and runs it in CI (#58). Report-only — no thresholds are configured,
so this cannot fail a build. The point is to make the gaps visible before deciding where to gate.

Three of the four TS repos already had a coverage block in vitest.config.ts but no provider
installed
, so it had never actually run.

What it found

Repo Statements Worst gaps
bitborg-payment 76.9% provider/mollie.ts 54.9% (lines 182-270 — the subscription, refund and getStatus methods)
bitborg-auth-reconciler 67.9% forgejo-http.ts 0% (211 lines that mutate production Forgejo), kanidm-http.ts 0%, http.ts 0%
bitborg-reconcile-trigger 72.1% server.ts 0% — the HTTP server itself
bitborg-web 40.5% middleware.ts 0% (every request), captcha.ts 0% (150 lines gating sign-up), auth/guard.ts 0% (the authorisation gate), rate-limit.ts 0%, auth/session.ts 23.7%

Two results worth calling out.

bitborg-payment's money core is at 100%. money.ts, vat.ts, pricing.ts, entitlements.ts and
config.ts do not appear in the report at all, because the table only lists files with uncovered
lines. The entire shortfall is the provider adapter, which matches the untested-methods finding filed
separately.

bitborg-web's real number is 40.5%, not the 62.6% it reports without coverage.include. This is
the one non-obvious part of the change: without include, v8 only reports files that a test happened
to import, so a file with no test is absent from the report entirely rather than showing as 0%.
guard.ts, captcha.ts, middleware.ts and rate-limit.ts were all invisible. Adding
coverage.include for src/lib/** + src/middleware.ts is what surfaced them, and it moved the
headline number down 22 points. A coverage figure that omits untested files flatters exactly the code
you most want to find.

Next, deliberately not in this PR

Per-glob thresholds ({ 100: true } on the money modules and src/lib/auth/**, negative-threshold
ratchets elsewhere) and the tests those thresholds would demand. Writing the tests is the actual
deliverable; the number is just the map. Gating on a 40% baseline today would only lock in the status
quo.

Also added coverage/ to bitborg-web's .gitignore — the other three already ignored it.

Refs #58

Adds `@vitest/coverage-v8` and runs it in CI (#58). **Report-only** — no thresholds are configured, so this cannot fail a build. The point is to make the gaps visible before deciding where to gate. Three of the four TS repos already had a `coverage` block in `vitest.config.ts` but **no provider installed**, so it had never actually run. ## What it found | Repo | Statements | Worst gaps | | --- | --- | --- | | bitborg-payment | 76.9% | `provider/mollie.ts` **54.9%** (lines 182-270 — the subscription, refund and getStatus methods) | | bitborg-auth-reconciler | 67.9% | `forgejo-http.ts` **0%** (211 lines that mutate production Forgejo), `kanidm-http.ts` **0%**, `http.ts` **0%** | | bitborg-reconcile-trigger | 72.1% | `server.ts` **0%** — the HTTP server itself | | bitborg-web | **40.5%** | `middleware.ts` **0%** (every request), `captcha.ts` **0%** (150 lines gating sign-up), `auth/guard.ts` **0%** (the authorisation gate), `rate-limit.ts` **0%**, `auth/session.ts` **23.7%** | Two results worth calling out. **bitborg-payment's money core is at 100%.** `money.ts`, `vat.ts`, `pricing.ts`, `entitlements.ts` and `config.ts` do not appear in the report at all, because the table only lists files with uncovered lines. The entire shortfall is the provider adapter, which matches the untested-methods finding filed separately. **bitborg-web's real number is 40.5%, not the 62.6% it reports without `coverage.include`.** This is the one non-obvious part of the change: without `include`, v8 only reports files that a test happened to import, so a file with *no* test is **absent from the report entirely** rather than showing as 0%. `guard.ts`, `captcha.ts`, `middleware.ts` and `rate-limit.ts` were all invisible. Adding `coverage.include` for `src/lib/**` + `src/middleware.ts` is what surfaced them, and it moved the headline number down 22 points. A coverage figure that omits untested files flatters exactly the code you most want to find. ## Next, deliberately not in this PR Per-glob thresholds (`{ 100: true }` on the money modules and `src/lib/auth/**`, negative-threshold ratchets elsewhere) and the tests those thresholds would demand. Writing the tests is the actual deliverable; the number is just the map. Gating on a 40% baseline today would only lock in the status quo. Also added `coverage/` to bitborg-web's `.gitignore` — the other three already ignored it. Refs #58
supernaut lade till 2 incheckningar 2026-07-29 19:00:02 +00:00
chore: drop fta
Alla kontroller lyckades
ci / ci (pull_request) Successful in 24s
ba70a13039
test: measure coverage in ci (report-only)
Alla kontroller lyckades
ci / ci (pull_request) Successful in 28s
fdeec79271
supernaut tvångsskickade test/coverage från fdeec79271
Alla kontroller lyckades
ci / ci (pull_request) Successful in 28s
till e8ef227957
Alla kontroller lyckades
ci / ci (pull_request) Successful in 29s
2026-07-29 19:32:38 +00:00
Jämför
supernaut sammanfogade incheckning 4e3c3e0f66 till main 2026-07-29 19:36:41 +00:00
supernaut tog bort grenen test/coverage 2026-07-29 19:36:42 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-07-29 19:36:42 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment!5
Ingen beskrivning angiven.