use case
How to view an Istanbul/nyc coverage report online
Parse an LCOV .info file from Istanbul or nyc to visualize JavaScript coverage without serving HTML files.
Istanbul (via the nyc command) is the standard JavaScript coverage tool for Mocha, Tap, and other non-Jest test runners. Running nyc --reporter=lcov generates a coverage/lcov.info file. The HTML report requires a local server and is often omitted in CI. This guide shows how to upload the LCOV output from nyc to the quickhelp.dev Coverage Viewer and read file-level coverage instantly.
Step-by-step guide
- Run your tests through nyc: Prefix your test command: nyc --reporter=lcov mocha tests/**/*.spec.js. The coverage directory is created with lcov.info inside.
- Open the viewer and upload: Go to quickhelp.dev/lcov-viewer, drag the lcov.info file onto the page. All source files appear in the table immediately.
- Identify coverage gaps: Use the sort controls to rank files by line coverage. Files with branch coverage below function coverage often have untested else branches in conditionals.
Frequently asked questions
- Does this work with c8 (V8 native coverage)?
- Yes — c8 can output LCOV format with --reporter=lcov. The resulting lcov.info file is compatible with this viewer.
- Why is branch coverage lower than line coverage?
- A line with a conditional is counted as covered when any branch is taken. Branch coverage counts each branch separately, so an untested else path lowers branch coverage even if the line was reached.
Try it now
Use the LCOV Coverage Viewer to complete this task — free, no sign-up, runs in your browser.
Open LCOV Coverage Viewer →