ExtendedLocalCoverage

Documentation for ExtendedLocalCoverage.

This package extends the functionality of LocalCoverage.jl by adding the following features:

  • Automatically extract the source files for the provided package using Revise.parse_pkg_files.
  • Automatically create an xml cobertura coverage, useful for Gitlab which can use it to automatically higlight missing coverage in the web ui of the merge requests.
  • Automatically generate a static HTML coverage report using a native julia implementation relying on HypertextTemplates.jl
    • Unlike the implementation in the original LocalCoverage.jl package, this does not require the LCOV dependency and also works on windows

This package was mainly created to provide easier access to code coverage within a private self-hosted gitlab instance, where codecov can not be used as is, but an HTML coverage report can be directly integrated within the gitlab web interface.

It is also convenient for getting an HTML coverage report locally without always relying on codecov from GH actions.

You can see an example of the generated HTML coverage report here, which was generated by calling generate_package_coverage(;) on this package.

Installation

The package is not currently registered in General, so you need to add it to your environment by doing:

] add https://github.com/disberd/ExtendedLocalCoverage.jl

or

import Pkg
Pkg.add(url="https://github.com/disberd/ExtendedLocalCoverage.jl")

Usage

For the basic usage which automatically extracts source files (including extensions) and generates the coverage report both in xml and html format, you can simply do the following (within the env of the package you are developing and making sure you have ExtendedLocalCoverage.jl in the LOAD_PATH):

using ExtendedLocalCoverage
cov_data = generate_package_coverage();