npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@idirdev/covercheck

v1.0.0

Published

Check code coverage against thresholds

Downloads

19

Readme

covercheck

[EN] Parse LCOV coverage reports and enforce line, branch, and function coverage thresholds — fail CI when coverage drops below your standards. [FR] Analysez les rapports de couverture LCOV et appliquez des seuils de couverture pour les lignes, branches et fonctions — faites échouer CI quand la couverture descend sous vos standards.


Features / Fonctionnalités

[EN]

  • Parses standard lcov.info files generated by Jest, Istanbul, c8, and others
  • Reports line, branch, and function coverage percentages per project
  • Configurable threshold (default 80%) via --threshold
  • Auto-detects coverage/lcov.info or lcov.info in the working directory
  • Custom file path via --file for non-standard output locations
  • Exits with code 1 on threshold failure — integrates cleanly with GitHub Actions
  • Zero external dependencies

[FR]

  • Analyse les fichiers lcov.info standard générés par Jest, Istanbul, c8, etc.
  • Affiche les pourcentages de couverture ligne, branche et fonction par projet
  • Seuil configurable (80% par défaut) via --threshold
  • Détection automatique de coverage/lcov.info ou lcov.info dans le répertoire courant
  • Chemin de fichier personnalisé via --file pour les emplacements non standard
  • Quitte avec le code 1 en cas d'échec de seuil — intégration facile avec GitHub Actions
  • Aucune dépendance externe

Installation

npm install -g @idirdev/covercheck

CLI Usage / Utilisation CLI

# Check coverage using auto-detected lcov.info
# Vérifier la couverture avec détection automatique de lcov.info
covercheck

# Specify a custom coverage file
# Spécifier un fichier de couverture personnalisé
covercheck --file ./coverage/lcov.info

# Set a custom threshold (90%)
# Définir un seuil personnalisé (90%)
covercheck --threshold 90

# Combine: custom file + strict 95% threshold
# Combiner : fichier personnalisé + seuil strict 95%
covercheck --file ./coverage/lcov.info --threshold 95

# Use in CI — exits 1 if coverage is insufficient
# Utiliser en CI — quitte avec 1 si la couverture est insuffisante
covercheck --threshold 80 || exit 1

Example Output / Exemple de sortie

Coverage (24 files):
  Lines:     87.42%
  Branches:  76.15%
  Functions: 91.30%

Threshold failures:
  Branches: 76.15% < 80%

API (Programmatic) / API (Programmation)

const fs = require('fs');
const {
  parseLcov,
  summarize,
  checkThresholds,
  findCoverageFile,
  calcPercentage
} = require('@idirdev/covercheck');

// Auto-find the lcov.info file in a project
// Trouver automatiquement le fichier lcov.info dans un projet
const filePath = findCoverageFile('./my-project');
// => './my-project/coverage/lcov.info'  or  null

// Parse LCOV content into a per-file structure
// Analyser le contenu LCOV en structure par fichier
const content = fs.readFileSync(filePath, 'utf8');
const files = parseLcov(content);
// => { 'src/index.js': { lines: { found: 100, hit: 87 }, branches: {...}, functions: {...} }, ... }

// Summarize into overall percentages
// Résumer en pourcentages globaux
const summary = summarize(files);
// => { lines: 87.42, branches: 76.15, functions: 91.3, fileCount: 24 }

// Check against thresholds
// Vérifier par rapport aux seuils
const result = checkThresholds(summary, { lines: 80, branches: 80, functions: 80 });
// => { ok: false, failures: ['Branches: 76.15% < 80%'] }

// Calculate a single percentage
// Calculer un seul pourcentage
calcPercentage(87, 100); // => 87
calcPercentage(0, 0);    // => 100 (no lines = fully covered)

License

MIT © idirdev