# istanbuljs/nyc

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/istanbuljs-nyc).**

5,746 stars · 365 forks · JavaScript · isc

## Links

- GitHub: https://github.com/istanbuljs/nyc
- Homepage: https://istanbul.js.org/
- awesome-repositories: https://awesome-repositories.com/repository/istanbuljs-nyc.md

## Topics

`code-coverage` `istanbul` `javascript`

## Description

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.

## Tags

### Part of an Awesome List

- [Code Coverage](https://awesome-repositories.com/f/awesome-lists/devtools/code-coverage.md) — Instruments JavaScript and TypeScript source files to track executed lines, branches, and functions during test runs.
- [Threshold Enforcements](https://awesome-repositories.com/f/awesome-lists/devtools/code-coverage/threshold-enforcements.md) — Fails the build process when code coverage percentages fall below minimum target thresholds for branches, lines, and functions. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))
- [HTML Visualizations](https://awesome-repositories.com/f/awesome-lists/devtools/code-coverage/html-visualizations.md) — Produces a browsable HTML report showing per-file code coverage with visual highlighting. ([source](https://istanbul.js.org/docs/advanced/alternative-reporters/))
- [Testing and Quality Assurance](https://awesome-repositories.com/f/awesome-lists/devtools/testing-and-quality-assurance.md) — Command line interface for code coverage.
- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — CLI for Istanbul coverage.

### Data & Databases

- [Coverage Data Aggregators](https://awesome-repositories.com/f/data-databases/multi-file-aggregators/coverage-data-aggregators.md) — Combines raw coverage data from separate test suites or independent runs into a single consolidated report. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))

### Development Tools & Productivity

- [Code Instrumentation Utilities](https://awesome-repositories.com/f/development-tools-productivity/code-instrumentation-utilities.md) — Instruments source files during execution to collect real-time code coverage statistics. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))
- [Source Code Mapping](https://awesome-repositories.com/f/development-tools-productivity/source-code-mapping.md) — Maps coverage data from transpiled code back to the original source files using source maps. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))
- [Transpilation Mapping](https://awesome-repositories.com/f/development-tools-productivity/source-code-mapping/plan-to-source-mapping/transpilation-mapping.md) — Maps coverage data from compiled TypeScript or ES2015+ code back to original source files using source maps.
- [Source Map Resolution](https://awesome-repositories.com/f/development-tools-productivity/source-code-mapping/source-map-resolution.md) — Preserves source maps during code rewriting to map coverage data from transpiled TypeScript or ES2015+ back to original lines.
- [Pre-instrumentation](https://awesome-repositories.com/f/development-tools-productivity/code-instrumentation-utilities/pre-instrumentation.md) — Instruments source files ahead of time to facilitate coverage tracking via source maps. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))
- [Subprocess Instrumentation](https://awesome-repositories.com/f/development-tools-productivity/code-instrumentation-utilities/subprocess-instrumentation.md) — Captures and merges code coverage data from multiple child processes spawned during tests. ([source](https://istanbul.js.org/))
- [TypeScript Instrumentation](https://awesome-repositories.com/f/development-tools-productivity/code-instrumentation-utilities/typescript-instrumentation.md) — Transpiles TypeScript source files to ensure compatible instrumentation and coverage tracking. ([source](https://istanbul.js.org/docs/tutorials))
- [Glob Pattern Selectors](https://awesome-repositories.com/f/development-tools-productivity/file-pattern-matching/regex-based-file-selection/glob-pattern-selectors.md) — Allows selecting source files for instrumentation using include and exclude glob patterns.
- [Modern JavaScript Instrumentation](https://awesome-repositories.com/f/development-tools-productivity/javascript-instrumentation-engines/modern-javascript-instrumentation.md) — Transpiles modern JavaScript syntax to ensure compatible instrumentation and coverage tracking. ([source](https://istanbul.js.org/docs/tutorials))

### Operating Systems & Systems Programming

- [Runtime Module Hooking](https://awesome-repositories.com/f/operating-systems-systems-programming/binary-analysis-capabilities/instrumentation-hooking/runtime-module-hooking.md) — Instruments source files on-the-fly by intercepting the Node.js module loading process with a custom require hook.
- [Coverage Summaries](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/terminal-interface-systems/terminal-output/coverage-summaries.md) — Provides coverage summaries and file-level statistics directly to the command line in text or TeamCity formats. ([source](https://istanbul.js.org/docs/advanced/alternative-reporters/))

### Testing & Quality Assurance

- [Build Gating Tools](https://awesome-repositories.com/f/testing-quality-assurance/build-gating-tools.md) — Acts as a validator that fails the build process when code coverage percentages fall below defined minimum thresholds.
- [Code Coverage Tools](https://awesome-repositories.com/f/testing-quality-assurance/code-quality-review/code-coverage-tools.md) — Provides a command-line tool to instrument JavaScript source files and track the execution of lines, branches, and functions.
- [Test Runner Wrappers](https://awesome-repositories.com/f/testing-quality-assurance/node-js-test-automation/test-runner-wrappers.md) — Functions as a wrapper for Node.js test runners, intercepting the module loading process to collect coverage data.
- [Test Runner Integrations](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/test-runner-integrations.md) — Connects with common testing frameworks to collect unified coverage data automatically via the command line. ([source](https://istanbul.js.org/))
- [Coverage Exclusions](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis/coverage-exclusions.md) — Provides mechanisms to ignore specific lines, blocks, or files from coverage metrics using inline hints and configuration. ([source](https://cdn.jsdelivr.net/gh/istanbuljs/nyc@main/README.md))
- [Report Generators](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis/report-generators.md) — Transforms raw coverage data into diverse report formats such as HTML, LCOV, JSON, and XML.
- [Detailed JSON Reporting](https://awesome-repositories.com/f/testing-quality-assurance/detailed-json-reporting.md) — Produces detailed JSON reports containing per-file coverage data for statements, functions, and branches. ([source](https://istanbul.js.org/docs/advanced/alternative-reporters/))
- [Summary Reports](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-reporters/summary-reports.md) — Outputs a concise JSON summary containing aggregate coverage percentages. ([source](https://istanbul.js.org/docs/advanced/alternative-reporters/))
- [Test Coverage Collections](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/coverage-diagnostics-reporting/test-coverage-collections.md) — Captures and merges coverage metrics from child processes spawned during the execution of tests.

### Software Engineering & Architecture

- [Analysis Report Serialization](https://awesome-repositories.com/f/software-engineering-architecture/diagnostic-reporting-formats/analysis-report-serialization.md) — Serializes coverage analysis results into multiple human-readable and machine-readable formats. ([source](https://istanbul.js.org/docs/advanced/))
- [Reporting Plugins](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/modular-plugin-architectures/plugin-based-architectures/reporting-plugins.md) — Uses a plugin-based architecture to output coverage results in multiple formats including HTML, LCOV, JSON, and XML.
