Removes records for files matching given regexp from LCOV file or stream
Last updated 5 years ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install lcov-filter 
SYNC missed versions from official npm registry.


Removing records for some files from lcov file


Build status dependencies devdependencies


npm install lcov-filter --save-dev
node node_modules/lcov-filter/index.js <> <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


Pipe file cover/ 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/ 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 service

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


I love testing and code coverage, and send coverage results to, 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 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

Current Tags

  • 0.1.1                                ...           latest (5 years ago)

6 Versions

  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (2)

Copyright 2014 - 2017 © |