Skip to content
compodocx
Skip to article content

Guide 12

Documentation Coverage

cngxjs (opens in new tab)Updated Guide12of 13

Every HTML build produces a coverage report: how much of each symbol carries a description. Set a threshold and the CLI exits non-zero below it, so CI can gate.

Gating in CI

bash
npx compodocx -p tsconfig.doc.json --coverageTest 80

Anything below 80% in the example above fails the build. Without a value the threshold is 70. Set it based on the strictness you’re aiming for. Most projects start at 50% and move it up as gaps close.

  • --coverageMinimumPerFile makes each file meet a threshold of its own.
  • --coverageTestThresholdFail false prints a warning instead of failing.
  • --coverageTestShowOnlyFailed lists only the files below the threshold.
  • --files src/a.ts --files src/b.ts with--coverageMinimumPerFile checks just those files and generates no docs, which suits a pre-commit hook.

What counts as documented

A symbol and each of its members count once, and each counts as documented when it has a non-empty description. Tags alone (@param,@returns) do not satisfy the description requirement. Private members are not counted, and symbols no entry point exports are left out of the report and the threshold.

Coverage page

The HTML output renders a Documentation Coverage page at the project root: the overall percentage and a list of symbols you can sort and filter by name or file, each linking to its page.--disableCoverage removes it. Pass an Istanbul summary with--unitTestCoverage coverage-summary.json to show test coverage alongside.

Public-API filtering

--publicApiOnly <dist> restricts the docs, and with them the coverage figure, to the names in an API Extractor report or your built package. Internal symbols stop dragging the percentage down, and the report focuses on the surface consumers actually see.