Skip to content

Commit

Permalink
Save test output in test2json format
Browse files Browse the repository at this point in the history
If `GO_TEST_JSON_OUTPUT_FILE` environment variable is set, write the
test output in test2json format.
  • Loading branch information
rail committed Nov 23, 2021
1 parent 442d7c1 commit 1ce9e34
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/tools/bzltestutil/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func Wrap(pkg string) error {
return fmt.Errorf("error while generating testreport: %s", werr)
}
}
if out, ok := os.LookupEnv("GO_TEST_JSON_OUTPUT_FILE"); ok {
if err := ioutil.WriteFile(out, jsonBuffer.Bytes(), 0664); err != nil {
return fmt.Errorf("error writing test json: %s", err)
}
}
return err
}

Expand Down

0 comments on commit 1ce9e34

Please sign in to comment.