This document describes automated checks that protect the TypeScript workspace
(packages/* and services/*).
The repository enforces a minimum aggregate line coverage threshold for TypeScript packages and services that ship unit tests.
| Setting | Location | Default |
|---|---|---|
| Threshold | coverage.config.json → lineThresholdPercent |
70 |
| Workspaces | coverage.config.json → workspaces |
SDK, tlock, bindings, keeper, agent, appraisal-api, receipt-cli, auction-template |
- Each configured workspace runs its existing
testscript under the Node.js test runner with--experimental-test-coverage. - Coverage is collected via the machine-readable lcov reporter (not the human TAP/spec summary table).
- Test files (
*.test.ts) are excluded; every non-test file undersrc/is included. Files never loaded by tests still contribute their source lines as uncovered. - The script prints per-workspace covered/total line counts and a weighted
aggregate:
sum(covered) / sum(total)across all configured workspaces. - 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).
pnpm install
pnpm coverage:testGitHub 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.
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.