Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit test categories when unused. #12750

Closed
kyteware opened this issue Sep 28, 2023 · 1 comment
Closed

Omit test categories when unused. #12750

kyteware opened this issue Sep 28, 2023 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-test S-triage Status: This issue is waiting on initial triage.

Comments

@kyteware
Copy link

Problem

Unused test categories clutter results, making them much less digestible on smaller terminals.

E.g. default output on a repository with a single unit test and no docs or main.rs tests:

cargo test
   Compiling game v0.1.0 (/Users/dworv/Coding/ubiquitous/game)
    Finished test [unoptimized + debuginfo] target(s) in 0.22s
     Running unittests src/lib.rs (target/debug/deps/game-8b0a87aac65c670c)

running 1 test
test tests::server::test ... ok

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

     Running unittests src/main.rs (target/debug/deps/game-349d00b1b415c1f8)

running 0 tests

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

   Doc-tests game

running 0 tests

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

Proposed Solution

Instead of showing these 0-test categories, omit them for a cleaner output:

cargo test
   Compiling game v0.1.0 (/Users/dworv/Coding/ubiquitous/game)
    Finished test [unoptimized + debuginfo] target(s) in 0.22s
     Running unittests src/lib.rs (target/debug/deps/game-8b0a87aac65c670c)

running 1 test
test tests::server::test ... ok

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

You could even make debugging easier for people that wonder why tests they add wrong don't show up with an extra line:

2 categories with 0 tests omitted

Notes

No response

@kyteware kyteware added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Sep 28, 2023
@kyteware kyteware changed the title Hide test categories when unused. Omit test categories when unused. Sep 28, 2023
@epage
Copy link
Contributor

epage commented Sep 28, 2023

At a quick glance, this looks like a duplicate of #2832. Closing in favor of that. If I missed something, let us know and we can re-open it if needed!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-test S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants