This package, `istanbul-threshold-checker`, provides a utility for validating code coverage reports generated by Istanbul against user-defined thresholds. It allows developers to enforce minimum coverage percentages or maximum allowed uncovered entities for statements, branches, lines, and functions. Thresholds can be configured globally for the entire project or on a per-file basis, offering granular control over coverage requirements. Last published in November 2016 at version 0.2.1, this module is considered abandoned. Its core functionality for checking coverage thresholds has since been integrated directly into the `istanbul` project's command-line interface, `nyc`, as well as into popular testing frameworks like Jest. Modern projects are advised to use `nyc`'s native threshold checking capabilities or those provided by their testing framework rather than relying on this standalone, unmaintained package. It strictly uses CommonJS `require` syntax and depends on an older version of `istanbul`, which may lead to compatibility issues with contemporary coverage formats.
npm install istanbul-threshold-checkerVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to manually collect a coverage report using `istanbul` and then use `istanbul-threshold-checker` to validate it against defined global and per-file thresholds.
Migrate to `nyc` for coverage reporting and threshold checks. See `nyc` documentation for `check-coverage` command and configuration options.
If direct integration with `istanbul-threshold-checker` is unavoidable, ensure your `istanbul` dependency is pinned to a version compatible with this package (e.g., `^0.4.0`). Otherwise, migrate to `nyc`'s native threshold features.
Always use `const checker = require('istanbul-threshold-checker');` when importing this module in a CommonJS environment.Ensure both `istanbul` (e.g., `npm install istanbul@^0.4.0`) and `istanbul-threshold-checker` (`npm install istanbul-threshold-checker`) are installed. Verify that `require('istanbul')` and `require('istanbul-threshold-checker')` are used, and that the `Collector` and `checkFailures` methods exist on the respective objects for the installed versions.Consult the `istanbul` documentation for the correct coverage object structure for versions around `0.4.x`. If using a newer coverage report, consider migrating to `nyc` which handles modern report formats and threshold checking natively.