Parsing and returning total of the summary intended to use inside CI to exit if threshold not reach

Usage no npm install needed!

<script type="module">
  import lcovTotal from '';



release workflow code style: prettier semantic-release npm (scoped) license

Table of contents


This simple package aim to parse files and provide the total coverage Number without fancy formatting or anything else, either in stdout or programmatically.

Here's why:

  • You need to assest coverage in your CI and fail below certain threshold
  • you don't want to do unredable awk chains
  • every other options outputs fancy colored output which is tediuous to parse and error prone


You can install locally

npm install lcov-total

You can install glocally

npm install -g lcov-total

Or use NPX

npx lcov-total


You can use lcov-total from command line providing file location eg:

npx lcov-total
# 100.00

If you pass the --gte=value flag you will get an exitCode 0 or 1 based on resulting coverage >= value expression, eg:

npx lcov-total --gte=90
echo $?
# 0

Or programmatically

const lcovTotal = require("lcov-total");
lcovTotal("/path/to/"); // this throws if any error


Project is pretty simple and straight forward for what is my needs, but if you have any idea you're welcome.

This projects uses commitlint with Angular configuration so be sure to use standard commit format or PR won't be accepted.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat(scope): some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request


Distributed under the MIT License. See LICENSE for more information.


Simone Corsi - @im_simonecorsi