How to correctly generate an HTML report of coverage with grcov

23 Views Asked by At

I am trying to follow this article on code coverage in Rust.

I ran these commands from the article:

CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' cargo test
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html

This is the screenshot of the report shown in the article: enter image description here

And this is a screenshot of the report I generated: enter image description here

I understand that of course the reports will be different, as I have a different code base. But I do not understand why I do not see any files listed in my report.

I know my unit test ran, from this output from the first command:

running 1 test
test analysis_engine::test::analysis_engine_test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s

     Running unittests src/bin/lich.rs (target/debug/deps/lich-59b92cf3de49f636)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests lich

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

If I generate Markdown instead, I actually see coverage information for each file:

$ grcov . --binary-path ./target/debug/deps/ -s . -t markdown --branch --ignore-not-existing --ignore '../*' --ignore "/*"
| file                         | coverage | covered   | missed_lines
            |
|------------------------------|----------|-----------|-----------------------------------------------------------------------------|
| src/bin/lich.rs              | 0.00%    | 0 / 41    | 27-80
            |
| src/config_engine.rs   | 83.43%   | 141 / 169 | 78-80, 105-111, 169, 193-195, 234, 240-245, 250, 254, 265-266, 270, 277-280 |
<snip>

Total coverage: 58.69%

I am looking for help understanding why my HTML report does not include a list of files, with coverage data for each.

0

There are 0 best solutions below