Convert HPC output into
lcov.info files that can be uploaded to coverage
services, like Codecov.
hpc-lcovfrom the releases page or install it from Hackage with your favorite package manager
- Run your tests with coverage enabled
stack test --coverage
- Cabal is not yet supported (https://github.com/brandonchinn178/hpc-lcov/issues/3)
- Upload the generated
lcov.infofile to your coverage service
How do I convert coverage for an executable?
Note: If you have both tests and executables, HPC will write module information to the same file. Because of this, you’ll have to load the coverage for each separately, with a
stack clean in between.
- Build a single executable with coverage enabled (e.g.
stack build :my-exe --coverage)
- Run the executable
- This should generate a
.tixfile in the current directory
- Run the following, specifying the package that builds the executable:
stack exec -- hpc-lcov --file my-exe.tix --main-package my-package
How do I merge coverage files?
Install LCOV (e.g.
brew install lcov)
lcov -a lcov1.info -a lcov2.info ... > lcov.info
- Add support for GHC 9.4 + 9.6
- Drop support for GHC < 8.10
- Drop support for GHC < 8.6
- Don’t error if the
Initial release of
- Generates LCOV files from HPC
.tixfiles generated by Stack test suites
- Allows manually specifying a
.tixfile (useful for executables with coverage enabled)