Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.95 KB

File metadata and controls

52 lines (38 loc) · 1.95 KB

CI and quality gates

This document describes automated checks that protect the TypeScript workspace (packages/* and services/*).

Test coverage gate

The repository enforces a minimum aggregate line coverage threshold for TypeScript packages and services that ship unit tests.

Setting Location Default
Threshold coverage.config.jsonlineThresholdPercent 70
Workspaces coverage.config.jsonworkspaces SDK, tlock, bindings, keeper, agent, appraisal-api, receipt-cli, auction-template

How coverage is computed

  1. Each configured workspace runs its existing test script under the Node.js test runner with --experimental-test-coverage.
  2. Coverage is collected via the machine-readable lcov reporter (not the human TAP/spec summary table).
  3. Test files (*.test.ts) are excluded; every non-test file under src/ is included. Files never loaded by tests still contribute their source lines as uncovered.
  4. The script prints per-workspace covered/total line counts and a weighted aggregate: sum(covered) / sum(total) across all configured workspaces.
  5. CI fails when the weighted aggregate drops below lineThresholdPercent.

Runner unit tests live in scripts/run-ts-coverage.test.mjs (node --test scripts/run-ts-coverage.test.mjs).

Run locally

pnpm install
pnpm coverage:test

CI workflow

GitHub Actions workflow: .github/workflows/coverage.yml

It runs on pushes and pull requests to main, prints the coverage summary to the job log, and fails the check when the threshold is not met.

Changing the threshold

Update lineThresholdPercent in coverage.config.json and mention the change in the PR. The default is calibrated against the weighted covered/total ratio after including unexecuted src/ files. Lower the threshold only when the existing codebase cannot meet a higher bar yet; prefer adding tests instead of weakening the gate.