Skip to content

Coverage Ratchet ​

Coverage thresholds are regression floors, not quality goals. Raise them only after a measured run shows enough margin for normal V8 coverage noise and after the added tests exercise meaningful behavior rather than implementation trivia.

The thresholds live in vitest.coverage.config.ts. Regenerate the snapshot with:

bash
pnpm test:coverage

Current Snapshot ​

Measured on 2026-09-29 with pnpm test:coverage.

ScopeStatementsBranchesFunctionsLines
All files87.2678.5790.9991.27
Browser package84.5173.8787.1489.28
Browser HTTP transport96.9093.8395.4599.55
Core package87.4280.1090.3490.68
OTLP package95.7985.06100.0098.68
Pretty package90.6484.9190.0094.02

Weak Spots ​

AreaMeasured gapNext action
OTLP packagePackage coverage meets the transport failure-path contract, but log-bridge.ts (74% branches) and trace.ts (78% branches) still carry untested fallback branches.Keep the package floor and add targeted tests when those branches change.
Pretty packagePackage coverage is close to the repository average. console-transport.ts branch coverage (67%) is the lowest file in the package.Keep package floors near measured coverage; do not raise file floors until console auto-style branches are covered.
Browser packageindexeddb-transport.ts (64% branches) pulls the package average down.Keep package floors conservative, keep the file-level floor for http-transport.ts, and improve IndexedDB edge coverage incrementally.

Ratchet Rules ​

  • Keep global thresholds at least two percentage points below the measured total unless the gap is intentionally narrow and documented here.
  • Prefer file-level thresholds for high-risk files that already have mature coverage, such as browser HTTP delivery and OTLP JSON mapping.
  • Do not raise a package threshold because another file compensates for an uncovered risky branch.
  • Coverage-only tests must still assert externally observable behavior: errors, retries, filtering, import boundaries, exported file names, lifecycle cleanup, or captured payload shape.
  • Lowering a threshold requires an explicit quality review in the same change.

Current Floors ​

ScopeFloor (statements / branches / functions / lines)Notes
Global86 / 76 / 90 / 90The next branch increase should come from browser or Node edge tests, not from Pretty compensation.
OTLP94 / 80 / 100 / 98Set after the transport failure-path tests.
Pretty88 / 82 / 88 / 92Set after the formatter, console fallback, and stream lifecycle tests.
Browser84 / 73 / 86 / 89http-transport.ts also has a file floor of 95 / 91 / 92 / 99.

Released under the MIT License.