xd009642 / tarpaulin

A code coverage tool for Rust projects
https://crates.io/crates/cargo-tarpaulin
Apache License 2.0
2.5k stars 180 forks source link

Generating coverage xml of a library that has examples produces line-rate=NaN #869

Closed flaminggoat closed 2 years ago

flaminggoat commented 2 years ago

Describe the bug Running with arguments --out Xml on a library containing an examples folder produces a section in the cobertura.xml:

        <package name="examples" line-rate="NaN" branch-rate="0" complexity="0">
            <classes></classes>
        </package>

This causes the overall line-rate to be NaN too.

Expected behavior Coverage for the examples should just be 0 if there are no tests.

xd009642 commented 2 years ago

I've just found the offending code in question and when the CI finishes I'll merge into develop and probably do a new patch release :+1:

xd009642 commented 2 years ago

And I'm an idiot who didn't actually commit and push their change... I did recreate and test on a recreation project and confirm it but here's the actual code change PR https://github.com/xd009642/tarpaulin/pull/871

xd009642 commented 2 years ago

I will also do that release tonight for version 0.18.4

flaminggoat commented 2 years ago

Thanks, It no longer generates NaN on my repo.