The testing package captures all output and will not print it unless a test fails or verbose (-v
) is turned on. Is there a way to output text after the suite is finished without needing verbose turned on?
For example:
func TestMain(m *testing.M) {
status := m.Run(m)
fmt.Println("important line to output")
os.Exit(status)
}
Will not print the line.
Edit: I have found out that fmt.Println
will work if you run the tests from inside the package (go test
), but not if one or more packages are specified (go test ./...
) unless the -v
option is enabled.