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 authored and rickystewart committed Apr 4, 2023
1 parent 993120e commit 3bf3350
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 @@ -139,6 +139,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 3bf3350

Please sign in to comment.