rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.81k stars 2.43k forks source link

In integration test output, print test path relative to workspace root rather than crate root #10642

Open bstrie opened 2 years ago

bstrie commented 2 years ago

Problem

If I have a workspace with crates foo and bar, and they both have integration tests, then running cargo test or cargo test --workspace produces output that looks like:

     Running tests/integration.rs (target/debug/deps/integration-90c5d22d758aa08c)

[...]

     Running tests/integration.rs (target/debug/deps/integration-71f1b5c00acba212)

Notable, nowhere in either of these lines (or in anywhere else in any of the integration test output) does Cargo associate which integration test output belongs to which crate.

Proposed Solution

It would be easier for users to visually parse the output here if Cargo would include some indication as to which crate each integration test belongs to, for example by using the path to the workspace root rather than the path to the crate root:

     Running bar/tests/integration.rs (target/debug/deps/integration-90c5d22d758aa08c)

[...]

     Running foo/tests/integration.rs (target/debug/deps/integration-71f1b5c00acba212)

Notes

No response

epage commented 2 years ago

This came from a zulip thread

When in a workspace, cargo generally shows everything relative to the workspace root, so this change makes sense to me though I have no idea the work required to do it or the side effects it may have.