jscoverage
a javascript coverage tool, can be used in node dev, and browser side js dev
Last updated 9 years ago by fish .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install jscoverage 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.5.7                                ...           0.5.7_beta (10 years ago)
  • 0.6.0                                ...           latest (9 years ago)

52 Versions

  • 0.6.0                                ...           9 years ago
  • 0.5.9                                ...           10 years ago
  • 0.5.8                                ...           10 years ago
  • 0.5.7                                ...           10 years ago
  • 0.5.6                                ...           10 years ago
  • 0.5.5                                ...           10 years ago
  • 0.5.4                                ...           10 years ago
  • 0.5.3                                ...           11 years ago
  • 0.5.2                                ...           11 years ago
  • 0.5.1                                ...           11 years ago
  • 0.5.0-rc2                                ...           11 years ago
  • 0.5.0-rc1                                ...           11 years ago
  • 0.5.0-pre                                ...           11 years ago
  • 0.3.8                                ...           11 years ago
  • 0.3.7                                ...           12 years ago
  • 0.3.6                                ...           12 years ago
  • 0.3.6-pre                                ...           12 years ago
  • 0.3.5                                ...           12 years ago
  • 0.3.4                                ...           12 years ago
  • 0.3.3                                ...           12 years ago
  • 0.3.2                                ...           12 years ago
  • 0.3.1                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.3.0-beta3                                ...           12 years ago
  • 0.3.0-beta2                                ...           12 years ago
  • 0.3.0-beta1                                ...           12 years ago
  • 0.3.0-beta                                ...           12 years ago
  • 0.3.0-alpha1                                ...           12 years ago
  • 0.2.5                                ...           12 years ago
  • 0.2.4                                ...           12 years ago
  • 0.2.3                                ...           12 years ago
  • 0.2.2                                ...           12 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.10                                ...           12 years ago
  • 0.1.9                                ...           12 years ago
  • 0.1.7                                ...           13 years ago
  • 0.1.5                                ...           13 years ago
  • 0.1.4                                ...           13 years ago
  • 0.1.3                                ...           13 years ago
  • 0.1.2                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
  • 0.1.0                                ...           13 years ago
  • 0.0.9                                ...           13 years ago
  • 0.0.8                                ...           13 years ago
  • 0.0.7                                ...           13 years ago
  • 0.0.6                                ...           13 years ago
  • 0.0.5                                ...           13 years ago
  • 0.0.4                                ...           13 years ago
  • 0.0.3                                ...           13 years ago
  • 0.0.2                                ...           13 years ago
  • 0.0.1                                ...           13 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |