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

@appbot.co/uncover

v0.2.2

Published

Clear line coverage for partially covered branches

Downloads

6

Readme

@appbot.co/uncover

Maintainability Test Coverage

npm version npm downloads node-current (scoped)

Several code quality tools can only handle line coverage, but that doesn't help when your production code is failing with missed branches, or uncovered methods.

This tool allow you to take your valid LCOV files, with the useful branch and function coverage, and modify the line coverage to reflect those misses.

Usage

Install

npm i @appbot.co/uncover
# or
yarn add @appbot.co/uncover

Run

For a single coverage file

uncover coverage/lcov.info > coverage/lcov.uncovered.info
# For your coverage provider, you may then need to rename it back to find it
mv coverage/lcov.uncovered.info coverage/lcov.info
# send to your coverage provider. eg.
# ./cc-test-reporter after-build -t lcov -p "./"

If your coverage is produced from multiple test runs

# store each runs coverage with unique ids
UUID=$(cat /proc/sys/kernel/random/uuid)
mv lcov.info lcov.$UUID.info

# once all the runs are complete, merge and uncover
uncover coverage/lcov.*.info > coverage/lcov.info
# you can now send to your coverage provider as though it was a single run. eg.
# ./cc-test-reporter after-build -t lcov -p "./"

📔 Notes

For Ruby: You will need to use the umbrellio fork with the method coverage branch to get method coverage until PR#987 is merged. For Javascript: c8 dose not currently produce correct branch and function coverage. Stick with nyc for now.

Uncovering

// javascript
if (something) {
  newThing = new Thing();
}
# ruby
newThing = Thing.new if something

Testing each of these with something set will show positive line coverage, and checking coverage locally would likely show the missing (branch) coverage from where it was non-truthy, but your online tool may not show that. For a PR with anything substantial going on, it's easy to miss a non-present test covering non-present code. Well, you won't any more. In fact, you may be triggered to look even harder, because now some code that seems obviously covered, will show no coverage at all.

# javascript
const meth = () => 'call me'
# ruby 3.1
def meth = 'call me'

These too would show positive line coverage, even when the method was never called. These are rectified by clearing the coverage for the line on which they were defined.

Here are before and after shots showing the coverage in the gutter on VSCode. Branch coverage can be seen in the before shot, but this will show as fully covered in some tools, as the method coverage is here.

before after

As an example of the lies that line coverage provides. When we enabled this tool at Appbot our coverage on Code Climate dropped by about 4%. Now excuse me while I go squash some potential bugs 🐛.

Merging

If you pass in multiple lcov files uncover will merge them ... properly. All the coverage elements get summed before uncover does its real work.

example:

uncover lcov.run1.info lcov.run2.info > lcov.info