-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: go test -json has package output incorrectly attributed to the last test when a test panics #35180
Comments
/cc @jayconrod @bcmills |
Possibly related to #27764? |
And almost certainly to #33419. |
This issue appears to be fixed since go1.14.1. I think 76a6adc fixed it. Here is the
This matches the expected output. In particular there is a "fail" action for both the test and the package. I tried go1.14.3 and it also works. Closing. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create a package with a single
example_test.go
as follows:Run the tests with
go test -json
.What did you expect to see?
I expected to see JSON events similar to what is printed for a test failure (except with the panic output). Here is an example:
In the example above the output
related to the package failing is attributed to the package, not the test (i.e. no "Test" key).
There is also a JSON event for the package result:
This matches the behavior for when a test fails. For example take the following failing test:
Running the above with
go test -json
results in the following:What did you see instead?
The output
related to the failure of the package is attributed to the last test and the "fail" action for the package is missing. Here is the output:
The text was updated successfully, but these errors were encountered: