In some situations it's necessary to have tests defined in a different workspace to the library. Currently afaict there is no way to record the coverage data from these tests. Here's an example setup: ``` ├── Cargo.toml ├── foo-tests/ │ ├── Cargo.toml │ └── tests/ │ └── foo.rs ├── src/ │ └── lib.rs └── tarpaulin.toml ``` ```toml # Cargo.toml [package] name = "foo" version = "0.1.0" edition = "2024" ``` ```toml # foo-tests/Cargo.toml [package] name = "foo-tests" version = "0.1.0" edition = "2024" [dependencies] foo.path = ".." ``` ```rs // foo-tests/tests/foo.rs #[test] fn test() { foo::add(1, 2); } ``` ```rs // src/lib.rs pub fn add(left: u64, right: u64) -> u64 { left + right } ``` ```toml # tarpaulin.toml [tests] manifest-path = "foo-tests/Cargo.toml" ``` Running coverage on it gives: ```console > cargo tarpaulin ... 2025-01-03T13:16:37.775101Z INFO cargo_tarpaulin::process_handling: running target/x86_64-unknown-linux-gnu/debug/deps/foo-be23343dc3c96be8 running 1 test test test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s 2025-01-03T13:16:37.932096Z INFO cargo_tarpaulin::report: Coverage Results: || Uncovered Lines: || Tested/Total Lines: || NaN% coverage, 0/0 lines covered ``` The `src/lib.rs` coverage data isn't recorded because it fails this check: https://github.com/xd009642/tarpaulin/blob/c493bc1d9e581b0c4bca5e3c07868a5579286cbb/src/path_utils.rs#L64 I think what is needed is the ability to have the root for the recorded coverage different to the root of the workspace used for resolving relative paths. (In the real project I ran into this on we have tests in both the root workspace and multiple sub-workspaces that we want to merge all together into one coverage report, with the majority of library code in the root workspace).
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by Nemo157 and has received 2 comments.