A command-line interface for Istanbul that instruments JavaScript code to collect test coverage metrics.
nyc is the command-line interface for Istanbul, a JavaScript code coverage tool. It instruments JavaScript code to track which lines, branches, and functions are executed during tests, generating coverage reports to help developers assess test effectiveness. It supports modern JavaScript features, source maps for transpiled code, and integrates with popular test runners.
JavaScript developers and teams using test runners like Mocha, AVA, or Tape who need to measure and improve their test coverage, especially in projects using Babel or TypeScript.
Developers choose nyc for its deep integration with the Istanbul ecosystem, extensive configuration options, support for complex scenarios like subprocesses and source maps, and its ability to work with almost any JavaScript test runner without requiring major workflow changes.
the Istanbul command line interface
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
nyc uniquely collects coverage from applications that spawn subprocesses, essential for complex Node.js workflows, as highlighted in the README's key features.
Accurately handles coverage for Babel and TypeScript projects via source maps, ensuring reports reflect the original source code, as emphasized in the README's description.
Offers multiple configuration methods including CLI, package.json, and various config files, allowing fine-grained control, with examples provided for JSON, YAML, and JS formats.
Enables setting custom coverage thresholds to fail builds if not met, integrating seamlessly with CI/CD pipelines, as detailed in the coverage thresholds section.
Requires additional presets and careful configuration for Babel or TypeScript, which can be error-prone and time-consuming, as the README advises using specific config packages.
The caching feature, while improving performance, can lead to stale coverage data if not properly invalidated, and the README lacks clear guidance on cache invalidation strategies.
Advanced features are documented across multiple pages, making it challenging for users to find comprehensive information without deep diving, as seen with links to external tutorials.