go-check / check

Rich testing for the Go language
Other
695 stars 180 forks source link

run: automatically turn on verbose mode if run with "go test -v" #126

Open jhenstridge opened 3 years ago

jhenstridge commented 3 years ago

If I'm working on a project that doesn't use go-check, I can run go test to see only failures, or go test -v to see status messages as each test is run. If the project is using go-check though, I'd need to run go test -v -check.v for the latter.

This is a pain if I've got a set of packages with some using go-check and others not, and want to run tests on all of them. If I run go test -v ./..., I miss out on status messages for the go-check modules. If I run go test -v ./... -check.v, the packages that don't use go-check fail because they don't understand the flag.

I can't think of many cases where you'd want to enable stdlib verbose mode but not go-check verbose mode, so this PR automatically turns on go-check verbose mode by checking testing.Verbose(). Looking at the docs on pkg.go.dev, this was added in Go 1.1, so shouldn't introduce a compatibility problem.