gotestsum icon indicating copy to clipboard operation
gotestsum copied to clipboard

Path `./...` does not respect the default of ignoring the vendor directory

Open sheldonhull opened this issue 3 years ago • 6 comments

When running a command like gotestsum --format testname -- -tags integration -race -shuffle=on ./... I am seeing output from the vendor directory which should be ignored.

I'd expect it to respect the default rules of the Go cli, which ignore dot prefix, underscore prefix, and the vendor directory.

edit: go test ./... -cover -shuffle on -race -v also seems to not honor this so I'll close this out as soon as I figure out why so if anyone runs into it they know why.

sheldonhull avatar Dec 14 '21 16:12 sheldonhull

That is unexpected. gotestsum does not handle the ./... at all, it passes it as an arg directly to go test. I tried to reproduce by running go mod vendor first and then gotestsum -- ./... and I don't see it running tests in vendor.

dnephin avatar Dec 14 '21 16:12 dnephin

Going to test further. I didn't expect this behavior either but it was timing out the pipeline builds in CI with this. I'll post an update once If figure this out in case others benefit. Cheers

sheldonhull avatar Dec 16 '21 22:12 sheldonhull

facing same issue where the gotestsum --format=testname -- ./... does not ignores the vendor/generated files includes them , even after explicitly defining exclusion.

karthick-ayyapillai avatar Apr 02 '22 21:04 karthick-ayyapillai

Thanks for the report! Can you provide some more information about your environment (full output of go version), and what happens if you run go test ./... in that same environment?

gotestsum does not interpret the ./... , it passes it directly to go test -json, so whatever is causing this is likely the behaviour of the go toolchain.

dnephin avatar Apr 02 '22 21:04 dnephin

Thanks for the report! Can you provide some more information about your environment (full output of go version), and what happens if you run go test ./... in that same environment?

gotestsum does not interpret the ./... , it passes it directly to go test -json, so whatever is causing this is likely the behaviour of the go toolchain.

Thanks for the clarification , does this mean if we are required to exclude vendor dir in gotestsum we can follow same approach as in go test $(go list ./... | grep -v vendor) Please find details requested. go version go1.17.8 darwin/amd64 : go -version result from go test ./... it runs all the test including vendors to exclude the vendor dir in go test go test ./... $(go list ./... | grep -v vendor)

karthick-ayyapillai avatar Apr 04 '22 07:04 karthick-ayyapillai

That you for confirming that go test also runs the tests in vendor!

I think you found a good workaround for the problem. I'm not sure why it does this, but it does seem to be an issue with go test.

dnephin avatar Apr 09 '22 17:04 dnephin