nyc is a JavaScript code coverage tool and command-line interface that instruments source files to track the execution of lines, branches, and functions during test runs. It acts as a wrapper for Node.js test runners, intercepting the module loading process to collect coverage data.
The tool functions as a coverage data merger and build gating tool, allowing users to combine results from multiple independent test runs or child processes into a single unified report. It can automatically fail the build process if code coverage percentages fall below defined minimum thresholds.
The project supports modern JavaScript and TypeScript by using source maps to link coverage data from transpiled code back to the original source files. It provides a multi-format reporting pipeline that outputs results as HTML, LCOV, JSON, XML, and plain text. Additional capabilities include glob-pattern file filtering, disk-based caching of instrumented files, and integration with testing frameworks such as Jest, Mocha, AVA, and tap.