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

Improve formatting of testing: warning: no tests to run #140

Closed
ghostsquad opened this issue Aug 8, 2020 · 2 comments · Fixed by #185
Closed

Improve formatting of testing: warning: no tests to run #140

ghostsquad opened this issue Aug 8, 2020 · 2 comments · Fixed by #185
Labels
enhancement New feature or request

Comments

@ghostsquad
Copy link

I'm seeing this warning when using gotestsum but not with go test

testing: warning: no tests to run

This seems to be something that go test emits in some cases, but I would then expect it to do so with go test.

❯ gotestsum --format testname ./...
testing: warning: no tests to run
PASS pkg/clioptions (cached)
PASS pkg/util/term.TestWordWrapWriter (0.00s)
PASS pkg/util/term.TestMaxWidthWriter (0.00s)
PASS pkg/util/term (cached)
PASS pkg/kubernetes/health/apis/apps/v1.TestDeploymentHealth (0.00s)
PASS pkg/kubernetes/health/apis/apps/v1 (cached)
PASS pkg/kubernetes/health/apis/extensions/v1beta1.TestIngressHealth (0.00s)
PASS pkg/kubernetes/health/apis/extensions/v1beta1 (cached)
EMPTY cmd/seaworthy
EMPTY pkg/cmd/verify
EMPTY pkg/errors
PASS pkg/kubernetes.TestResourcerOptions_GetCmdArgs/blah (0.00s)
PASS pkg/kubernetes.TestResourcerOptions_GetCmdArgs (0.00s)
PASS pkg/kubernetes.TestGetEvents/valid_args_provided (0.00s)
PASS pkg/kubernetes.TestGetEvents/blah (0.00s)
PASS pkg/kubernetes.TestGetEvents (0.00s)
PASS pkg/kubernetes.TestGetResources (0.00s)
PASS pkg/kubernetes.TestKubeCtlRawResourcer (0.00s)
PASS pkg/kubernetes.Test_kubectlRawResourcer (0.00s)
PASS pkg/kubernetes.Test_resourcesFromBytes (0.00s)
PASS pkg/kubernetes
EMPTY pkg/kubernetes/health
EMPTY pkg/kubernetes/health/apis/core/v1
EMPTY pkg/kubernetes/health/install
EMPTY pkg/util/sh
EMPTY pkg/util/templates

DONE 13 tests in 3.995s

12:55:31 in seaworthy on  main [!+] via 🐹 v1.14.4 took 4s
❯ go test ./...
?   	github.com/cakehappens/seaworthy/cmd/seaworthy	[no test files]
ok  	github.com/cakehappens/seaworthy/pkg/clioptions	0.224s [no tests to run]
?   	github.com/cakehappens/seaworthy/pkg/cmd/verify	[no test files]
?   	github.com/cakehappens/seaworthy/pkg/errors	[no test files]
ok  	github.com/cakehappens/seaworthy/pkg/kubernetes	0.698s
?   	github.com/cakehappens/seaworthy/pkg/kubernetes/health	[no test files]
ok  	github.com/cakehappens/seaworthy/pkg/kubernetes/health/apis/apps/v1	0.513s
?   	github.com/cakehappens/seaworthy/pkg/kubernetes/health/apis/core/v1	[no test files]
ok  	github.com/cakehappens/seaworthy/pkg/kubernetes/health/apis/extensions/v1beta1	0.336s
?   	github.com/cakehappens/seaworthy/pkg/kubernetes/health/install	[no test files]
?   	github.com/cakehappens/seaworthy/pkg/util/sh	[no test files]
?   	github.com/cakehappens/seaworthy/pkg/util/templates	[no test files]
ok  	github.com/cakehappens/seaworthy/pkg/util/term	0.205s
12:56:21 in seaworthy on  main [!+] via 🐹 v1.14.4 took 2s

I don't entirely understand why this is happening. Any ideas?

@dnephin dnephin added the question Further information is requested label Aug 8, 2020
@dnephin
Copy link
Member

dnephin commented Aug 8, 2020

That's interesting, I don't think I have seen that in the gotestsum output before. It comes from go test for sure (https://github.com/golang/go/blob/master/src/cmd/go/go_test.go#L122). There are also a couple places in testing that seem to print this line.

I would try go test -v ./... which may print it. Also go test -json ./... is what gotestsum will run. You may see it in that output and it might contain more information about which package it comes from.

This could be a bug in the testname format accidentally hiding some lines that should be printed.

@ghostsquad
Copy link
Author

ok, so I found the problem. I have _test.go file but without any tests in it. Just an empty-ish file. I think it would be nice if gotestsum formatted it properly to show me where this message was coming from.

{"Time":"2020-08-08T14:03:11.546098-07:00","Action":"output","Package":"github.com/cakehappens/seaworthy/pkg/clioptions","Output":"testing: warning: no tests to run\n"}

It contains this line, along with the usual output: PASS for the same package.

@dnephin dnephin added enhancement New feature or request and removed question Further information is requested labels Aug 8, 2020
@dnephin dnephin changed the title testing: warning: no tests to run Improve formatting of testing: warning: no tests to run Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants