bazel-coverage-report-renderer: HTML Coverage Reports for Rules_Haskell

[ apache, build-tool, program ] [ Propose Tags ]

Generate coverage reports from Rules_Haskell Bazel coverage output


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0
Dependencies base (>=4.12.0.0 && <4.13), cmdargs (>=0.10.20 && <0.11), directory (>=1.3.3.0 && <1.4), filepath (>=1.4.2.1 && <1.5), hxt (>=9.3.1.16 && <9.4), hxt-xpath (>=9.1.2.2 && <9.2), listsafe (>=0.1.0.1 && <0.2), MissingH (>=1.4.1.0 && <1.5) [details]
License Apache-2.0
Copyright 2019 Tweag I/O Limited
Author Tweag I/O Limited
Maintainer m@tweag.io
Category Build Tool
Home page https://github.com/tweag/rules_haskell#readme
Bug tracker https://github.com/tweag/rules_haskell/issues
Source repo head: git clone https://github.com/tweag/rules_haskell
Uploaded by SebastianKazenbrootGuppy at 2019-05-23T20:36:25Z
Distributions
Executables bazel-coverage-report-renderer
Downloads 572 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2019-05-23 [all 3 reports]

Readme for bazel-coverage-report-renderer-0.1.0

[back to package description]

coverage-reports

An executable which reads Bazel test.xml test results generated by bazel coverage for Rules_Haskell's haskell_test rule. These rules must have coverage_report_format set to "html" to be compatible with this tool.

Example Usage

If we have a target defined by the Rules_Haskell haskell_test rule, such as:

haskell_test(
    name = "two-libs",
    srcs = [
        ...
    ],
    coverage_report_format = "html", # this must be set to "html" (not "text")
    expected_covered_expressions_percentage = ...,
    expected_uncovered_expression_count = ...,
    deps = [
        ...
    ],
)

If we run bazel coverage //path/to/package:two-libs, the HTML report files will be appended to the test log (visible with --test_output=all set, or by looking in the bazel-testlogs directory at the relevant test.xml file). Bazel test rules cannot generate output files, hence why we append the HTML reports directly into the testlog.

Next, to extract the HTML reports and make them viewable in a browser, we use this tool, the bazel-coverage-report-renderer. It's as simple as running:

bazel-coverage-report-renderer \
    --testlog=<path/to/bazel-testlogs>/<path/to/package>two-libs/test.xml \
    --destdir=path/to/destination/directory>

The tool will tell you where you can find the resulting files. The hpc_index.html file is the homepage for your coverage results.