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

jscoverage

v0.6.0

Published

a javascript coverage tool, can be used in node dev, and browser side js dev

Downloads

13,530

Readme

jscoverage

logo

jscoverage tool, both node.js or javascript support

Build Status NPM version

install

npm install jscoverage

changelog

from v0.5.0, jscoverage start using uglify2, and enhance the coverage range. now, jscoverage will find out which branch you missed!

Get start

using mocha loading the jscoverage module, then it's work:

mocha -r jscoverage test/

jscoverage will append coverage info when you select list or spec or tap reporter in mocha

mocha -r jscoverage -R spec test/

besides, you can use --covout to specify the reporter, like html, detail. the detail reporter will print the uncovered code in the console directly.

using jscoverage with mocha

full modelł:

mocha -r jscoverage --covignore .covignore --covout=html --covinject=true --coverage=90,85,75 test

the cmd above means:

  • mocha run test case with jscoverage module
  • jscoverage will ignore files while list in .covignore file
  • jscoverage will output a report in html format
  • jscoverage will inject a group of function to your module.exports (_get, _set, _reset, _replace);
  • jscoverage will switch the colorful output: 90%+ is greate, 85%+ is ok, lower then 75% coverage is terrible

jscoverage can recognise all options below:

 --covignore [filepath] # like gitignore, tell jscoverage to ignore these files
 --overrideIgnore [boolean] # set if override the build-in ignore rules
 --covout [output report] # can be:  spec, list, tap, detail, html
 --coverage [high,middle,low] # coverage level, default is: 90,70,30 , means 90% is high, 30% is low
 --covinject [boolean] # switch if inject code for easytest(exports._get, exports._replace, exports._reset)

default jscoverage will search .covignore in the project root

using jscoverage as cli command

jscoverage
# print help info
jscoverage source.js
# convert source.js to source-cov.js
jscoverage source.js dest.js
# convert source.js to dest.js
jscoverage sourcedir destdir --exclude a.js,b.js,c.js,*.min.js
# convert all files in sourcedir to destdir, exclude list will be ignored

jscoverage will copy exclude file from source dir to dest dir

using inject api for node.js test

var testMod = require('module/for/test.js');

testMod._get('name');
testMod._replace('name', value);
testMod._reset();
testMod._call();

inline ignore annotation

using bellow comment, jscoverage will ignore the following block/statement

  /* @covignore */

using jscoverage programmatically

comming soon

mocha global leaks detect

The follow object will be detected, all of them are created by jscoverage.

  • _$jscoverage
  • _$jscmd