mocha-spec-cov-alt
v1.1.1
Published
Mocha/blanket spec coverage reporter and enforcer.
Downloads
92
Maintainers
Readme
mocha-spec-cov-alt
A Mocha reporter, which extends the spec
runner to display and (optionally)
enforce blanket Code Coverage metrics. Applying it to other runners, should
be as simple as replacing the .super_
SpecCov
property.
I wrote a blog post about it a while back.
This was heavily inspired by Alex Seville's work on the
travis-cov
.
Install it with:
npm install mocha-spec-cov-alt
Simple usage
The easiest way to set this up, right now, is to run:
$ npm i -g mocha-spec-cov-alt
# ...
/usr/local/bin/mocha-spec-cov-alt -> /usr/local/lib/node_modules/mocha-spec-cov-alt/bin/index.js
[email protected] /usr/local/lib/node_modules/mocha-spec-cov-alt
$ mocha-spec-cov-alt
Adding mocha-spec-cov-alt to your package.json... OK
Adding `mocha`, `mocha-spec-cov-alt` and `blanket` through npm:
[email protected] node_modules/mocha
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])
[email protected] node_modules/blanket
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
This will automatically add all the required nodes to your package.json
file,
install the dependencies and quit. You can then run tests with npm test
.
Usage
To use it, add the key "spec-cov"
to the "config": { "blanket": {} }
node
in your package.json
file. Currently supported options are:
threshold
- A global threshold to enforce. (defaults to 80)localThreshold
- A local threshold to enforce.lcovOutput
- A path to a file to outputlcov
data to, for use with CodeClimate or CoverAlls. (by default, the file won't be generated)
You should then run mocha with:
mocha --require blanket -R mocha-spec-cov-alt
For more info on setting-up blanket, see: https://github.com/alex-seville/blanket
The annotated source is avaible at https://yamadapc.github.io/mocha-spec-cov-alt and was generated with docco.
License
Copyright (c) 2014 Pedro Tacla Yamada. Licensed under the MIT license. Please refer to the LICENSE file for more info.
Donations
Would you like to buy me a beer? Send bitcoin to 3JjxJydvoJjTrhLL86LGMc8cNB16pTAF3y