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

Version 0.18.1 breaks using `--test-threads 1` #819

Closed jonasbb closed 3 years ago

jonasbb commented 3 years ago

I run cargo-tarpaulin on CI using stable Rust with --workspace --all-features -- --test-threads 1 as arguments. This worked fine, but with version 0.18.1 I get an empty coverage result. I noticed it first on this PR which only modifies documentation, so should not have any effect on the coverage.

I did not modify the CI environment. The only difference is that tarpaulin released a new version, which got picked up. I can reproduce the problem locally too, by installing either version 0.18.0, which works as expected, or version 0.18.1, which shows 0 coverage. I could reproduce it with cargo 1.54.0 (5ae8d74b3 2021-06-22) and cargo 1.56.0-nightly (cc17afbb0 2021-08-02). I used the serde_with crate to verify the bug.

# cargo-tarpaulin version: 0.18.0
cargo tarpaulin --workspace --all-features --out Html -- --test-threads 1
76.78% coverage, 2076/2704 lines covered, +0% change in coverage

# cargo-tarpaulin version: 0.18.1
cargo tarpaulin --workspace --all-features --out Html -- --test-threads 1
0.00% coverage, 0/2704 lines covered, -76.77514792899409% change in coverage

The problem seems to be that --test-threads 1 no longer specifies a number of threads, but gets interpreted as a filter which tests to run. None of the tests run, thus I get a 0 coverage.

running 0 tests

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

I would expect that the version of tarpaulin has no effect on how these arguments are parsed, since this way worked since at least 1.5 years without problems. It seems that --test-threads=1 (with an = sign) still works and limits the testing to a single thread.

xd009642 commented 3 years ago

I've just tracked down the issue that caused this, just sorting out a test to prevent another regression and I'll push out a 0.18.2 later today :+1:

jonasbb commented 3 years ago

Thanks for fixing this issue so quickly :)