golang/go
View on GitHubcmd/go: test with `-run /something` prints "no tests to run" inconsistently
Open
#48,851 opened on Oct 7, 2021
GoCommandNeedsFixhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
When running a test with -run /subtest_name where no subtests match, it will print okay, even though no tests were run. Same is true if you use -run Test/subtest_name.
If instead, you do -run TestNameInPackage/subtest_name (where TestNameInPackage is the name of a test in that package) it will print "[no tests to run]"
Example:
➜ go test archive/tar -run /nomatchinghere
ok archive/tar 0.145s
➜ go test archive/tar -run Test/nomatchinghere
ok archive/tar 0.164s
➜ go test archive/tar -run TestWrite/nomatchinghere
ok archive/tar 0.138s [no tests to run]
It has a similar issue when -v is set
/cc @bcmills @jayconrod @matloob