rust-lang / rust-lang/cargo

Fail or warn when using an overrestricitve test filter that filters all tests

Open
#6,151 10 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-test S-blocked-external
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

I'm not sure if this or the rust repo (libtest) is the right place to report this.

It's possible to run cargo test <pattern> to run the tests that match the given pattern.

However, if I run cargo test this_does_not_exist, everything looks green in the output. For example, if I run cargo test mod_floors in Chrono, it will look like this:

selection_008

On the first glance, it looks like everything is green and all tests passed.
It doesn't tell me that no tests were executed. I really wanted to run cargo test mod_floor:

selection_009

It would be nice if cargo test somehow tells me that no tests were executed.

Maybe adding a yellow or red warning text could be a good start?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with cargo test this_does_not_exist and compare it with a pattern that matches tests. Trace Cargo's test-filtering and result-reporting entry points; done means an overrestrictive filter clearly warns or fails when no tests are executed.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.