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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nyc-diff

v0.2.1

Published

Get line-by-line coverage for diff output.

Downloads

6

Readme

nyc-diff

Make sure every addition and modification is covered with nyc-diff by reporting coverage for changed lines from a unified diff format.

Installation

npm i -g nyc-diff

Usage

You can pipe any unified diff output into the nyc-diff via stdin. An example of usage with git-diff is shown below:

git diff -w <commit-ish>...<commit-ish> | nyc-diff [options]

Output

A JSON file named nyc-diff-<unix timestamp> will be generated when the diff is calculated succesfully in the format shown below. The path of the file can be modified as well by modifying the --output option.

[
	[<path from git diff>, <array of line numbers>],
	... and more
]

Options

--project-dir

This is the location in the local file system where code was instrumented by nyc. In most common situations this would be the root of your repository. Otherwise, wherever the .nyc_output folder of your nyc run is located.

--output / -o

Path at which the resultant JSON will be written to as .nyc-diff-\<unix-timestamp\>. This defaults next to the same directory as .nyc_output.

Limitations

  1. Currently only supports checking coverage of individual statements and not the coverage of their branches.
  2. Can only be used with pipe and does not support cli args.
  3. This tool is built around nyc v14.1.1. This tool's functionality is subject to nyc's output format. This might be changed in future versions of nyc, to ensure complete compatibility remain on the same major version.

Motivation

Working towards 100% coverage can be a troublesome task, especially at SaaS and product businesses where development on a code base never stops. nyc-diff was created to support development teams so as to ensure that any code that has been added or modified has unit-tests written for it.

Credits

Idea was all @KlentyBoogi.