Open lasantosr opened 6 months ago
I've faced the same issue as #278, i'll try to provide a reproducible example:
Create a new workspace with the following structure:
├── Cargo.toml ├── crate-a │ ├── Cargo.toml │ └── src │ └── lib.rs └── crate-b ├── Cargo.toml └── src └── lib.rs
The content of the files:
[workspace] members = ["crate-a", "crate-b"]
[package] name = "crate-a" version = "0.1.0" edition = "2021" [dependencies]
crate-a/src/lib.rs:
pub fn say_hello() { println!("Hello, world!"); } #[cfg(test)] mod test { #[test] fn test_say_hello() { super::say_hello(); } }
[package] name = "crate-b" version = "0.1.0" edition = "2021" [dependencies] crate-a = { path = "../crate-a" }
crate-b/src/lib.rs:
pub fn say_hello_goodby() { crate_a::say_hello(); println!("Goodby!"); } #[cfg(test)] mod test { #[test] fn test_say_hello_goodby() { super::say_hello_goodby(); } }
Run the coverage report just for crate-b: cargo llvm-cov --package crate-b
cargo llvm-cov --package crate-b
This is the actual output:
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- crate-a/src/lib.rs 1 0 100.00% 1 0 100.00% 3 0 100.00% 0 0 - crate-b/src/lib.rs 2 0 100.00% 2 0 100.00% 7 0 100.00% 0 0 - ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- TOTAL 3 0 100.00% 3 0 100.00% 10 0 100.00% 0 0 -
This is the expected output:
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/lib.rs 2 0 100.00% 2 0 100.00% 7 0 100.00% 0 0 - ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- TOTAL 2 0 100.00% 2 0 100.00% 7 0 100.00% 0 0 -
It can be achieved ignoring crate-a from the files, but it increases in complexity as the workspace has more members: cargo llvm-cov --package crate-b --ignore-filename-regex '(^|\/)crate-a'
cargo llvm-cov --package crate-b --ignore-filename-regex '(^|\/)crate-a'
Thanks. The problem here appears to be similar to #303, and perhaps something in the implementation of #31 is not working well.
I've faced the same issue as #278, i'll try to provide a reproducible example:
Create a new workspace with the following structure:
The content of the files:
crate-a/src/lib.rs:
crate-b/src/lib.rs:
Run the coverage report just for crate-b:
cargo llvm-cov --package crate-b
This is the actual output:
This is the expected output:
It can be achieved ignoring crate-a from the files, but it increases in complexity as the workspace has more members:
cargo llvm-cov --package crate-b --ignore-filename-regex '(^|\/)crate-a'