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

diff-cover

v2.0.5

Published

A Tool to Show Code Coverage for Modified Lines in a Diff

Readme

diff-cover-ts

License: MIT npm version npm downloads CI TypeScript Bun Code Style

A high-performance TypeScript port of the diff_cover tool.

Automatically find lines of code in your git diff that are missing test coverage or quality checks.

English | 简体中文


📖 Table of Contents

🚀 Introduction

diff_cover_ts helps you maintain high code quality by focusing on what matters most: the code you just changed. Instead of failing builds because of low legacy coverage, this tool ensures that every new commit meets your quality standards.

It works by comparing your current branch with a base branch (e.g., origin/main) and reporting coverage/quality gaps only for the modified lines.

✨ Features

  • 🎯 Precision Coverage: Report code coverage only for modified lines in your git diff.
  • 🛡️ Quality Gate: Enforce linting checks only on changed code.
  • 🤖 Auto-Configuration: Seamlessly detects vite.config.ts/js or vitest.config.ts/js to find coverage reports.
  • 📊 Multi-Format Support: Compatible with lcov, cobertura, clover, jacoco, and generic XML reports.
  • ⚡ Git Integration: Built-in git history analysis to identify modified lines accurately.
  • 🚫 Fail-Under Checks: Set thresholds to fail CI/CD pipelines if coverage/quality is too low.

📦 Installation

# Using npm (Global)
npm install -g diff-cover

# Using Bun (Global)
bun add -g diff-cover

# Using npm (Dev Dependency)
npm install diff-cover --save-dev

🛠 Usage

Diff Cover

Automatically identify lines in your diff that lack test coverage.

⚡ Auto Configuration (Recommended)

If you are using Vite or Vitest, simply run:

diff-cover

The tool will intelligently parse your configuration files to locate the coverage report and determine the format.

📝 Manual Usage

You can explicitly specify the coverage report files:

diff-cover coverage/lcov.info
# OR
diff-cover coverage/cobertura.xml

⚙️ Options

| Option | Description | Default | | :-------------------------- | :----------------------------------------------------------- | :------------ | | --compare-branch <branch> | Branch to compare against | origin/main | | --fail-under <score> | Returns a non-zero exit code if coverage is below this value | 0 | | --show-uncovered | Print uncovered lines to the console | false | | --expand-coverage-report | Append missing lines based on previous line hits | false | | --ignore-staged | Ignore staged changes in the diff | false | | --ignore-unstaged | Ignore unstaged changes in the diff | false | | --include-untracked | Include untracked files in the analysis | false | | --exclude <patterns...> | Exclude files matching glob patterns | [] | | --include <patterns...> | Include files matching glob patterns | [] | | --html-report <file> | Generate an HTML report at the specified path | null | | --json-report <file> | Generate a JSON report at the specified path | null |


Diff Quality

Run static analysis tools and report violations only on modified lines.

diff-quality report.txt --violations <driver>

🔌 Supported Drivers

  • eslint
  • pylint
  • flake8
  • shellcheck
  • cppcheck
  • checkstyle
  • findbugs

⚙️ Options

| Option | Description | Default | | :-------------------------- | :----------------------------------------------------------- | :------------ | | --compare-branch <branch> | Branch to compare against | origin/main | | --fail-under <score> | Returns a non-zero exit code if quality score is below value | 0 | | --include-untracked | Include untracked files | false | | --exclude <patterns...> | Exclude files matching glob patterns | [] | | --html-report <file> | Generate an HTML report at the specified path | null |

💻 Development

Setup

# Install dependencies
bun install

Testing

# Run test suite
bun test

# Run tests with coverage
bun test --coverage

Code Quality

We use oxlint for linting and oxfmt for formatting. Pre-commit hooks via husky ensure code quality.

# Lint code
bun run lint

# Format code
bun run format

📄 License

This project is licensed under the MIT License.