Removing records for some files from lcov file
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
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
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:
- 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.
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