nyc is a command-line code coverage tool for JavaScript that instruments your code to track how well your unit tests exercise your codebase.
Istanbul works by instrumenting ES5 and ES2015+ JavaScript with line counters, allowing developers to measure test coverage. The nyc command-line client integrates with most JavaScript testing frameworks including tap, mocha, and AVA. It handles applications that spawn subprocesses and provides source-mapped coverage for Babel and TypeScript projects, making it straightforward to see which lines of code are exercised by tests.
You should choose nyc if you use a testing framework other than Jest or tap, which have built-in coverage support. The tool works well for projects written in plain JavaScript, Babel, or TypeScript. Installation is simple via npm or yarn as a dev dependency, and configuration supports multiple file formats including JSON, YAML, and JavaScript. Pre-configured presets exist for Babel and TypeScript projects, allowing you to extend them with custom options rather than starting from scratch.
The project receives substantial real-world usage based on the volume of issues raised by outside users. However, responses to issues and pull requests often take weeks or longer, which matters if you encounter problems or need changes. The issue tracker is dominated by questions, triaged bugs, and support requests rather than feature development, suggesting the tool is mature and primarily maintained in a reactive mode.