Share an Istanbul / nyc coverage report
nyc report --reporter=html produces the single most useful coverage artifact
in the JavaScript ecosystem: a summary table you can sort by branch coverage,
and behind every row a page with the uncovered lines highlighted in red and
the uncovered branches marked with I and E.
It is also a folder of several hundred files. So it never leaves the machine
that produced it, and the conversation about coverage happens over a
text-summary paste that says Branches: 71.4% and nothing about which
branches.
Publish the tree
npx nyc report --reporter=html --reporter=text-summary # → coverage/
Or straight from the runner:
npx jest --coverage --coverageReporters=html
npx vitest run --coverage # v8 or istanbul provider
Drag coverage/ (or a zip of it) into the app:
index.htmlbecomes the report body — the sortable summary.- Every per-file page,
base.css,prettify.js,sorter.jsandblock-navigation.jsupload as assets, and their relative references are rewritten to the uploaded copies. - Scripts run inside a sandboxed iframe (
allow-scripts, noallow-same-origin), so column sorting and the next/prev-uncovered keyboard navigation still work.
The drill-down is the whole point of the Istanbul reporter, and it survives the trip.