Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

lcov-filter

0.1.1 • Public • Published

lcov-filter

Removing records for some files from lcov file

NPM

Build status dependencies devdependencies

Use

npm install lcov-filter --save-dev
node node_modules/lcov-filter/index.js <lcov.info> <filenames to exclude>

-- filename to exclude is used as RegExp

Filtered result is printed to STDOUT and can be piped to other tools, for example to send to coveralls.io

Example

Pipe file cover/lcov.info and remove info for files that contain word test in the path, the output is then piped through coveralls module

node node_modules/lcov-filter/index.js cover/lcov.info test | ./node_modules/coveralls/bin/coveralls.js

It is better to use from a script command inside package.json, for example to send filtered data the the coveralls.io service

"scripts"{
  "coveralls": "lcov-filter cover/lcov.info test | ./node_modules/coveralls/bin/coveralls.js",
}

Why?

I love testing and code coverage, and send coverage results to coveralls.io, which gives me nice badges. The problem is that sending combined code coverage for the soure code AND unit test code skews the average number upwards:

For example:

  • actual code is covered at 80%
  • unit test is covered at 100%
  • coveralls badge shows respectable, but misleading 90% code coverage

I am using lcov-filter to filter out test files from the code coverage before sending to coveralls.io generating more meaningful numbers. qunit-promises is one example that now reports only code coverage without adding tests.

Small print

Author: Gleb Bahmutov © 2014

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

install

npm i lcov-filter

Downloadsweekly downloads

28

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar