gotestsum
gotestsum copied to clipboard
Implement error reporter format for GitHub Actions
- https://github.com/gotestyourself/gotestsum/issues/540
Not sure how else to showcase it without having failing CI builds but here's an output example
This pull request adds support for emitting GitHub Actions error annotations for failed tests in the githubActionsFormat output. The main changes include parsing test output for failure locations, handling panics specially, and generating error annotations with file and line information for easier debugging in CI environments.
GitHub Actions error annotation support:
- Added regex-based parsing of test output to extract file and line information for failed tests and panics (
fileLinePattern,panicStackPatternintestjson/format.go). [1] [2] - Introduced the
writeGitHubActionsErrorfunction to emit error annotations in GitHub Actions format, including special handling for panics and regular failures, with proper sanitization of annotation fields (testjson/format.go). - Modified the test formatter to call
writeGitHubActionsErroron failed test events, resulting in error annotations for each failure (testjson/format.go).
Test output updates:
- Updated expected output in
testjson/testdata/format/github-actions.outto include new error annotations for each failed test, showing file, line, and test name information. [1] [2] [3] [4] [5] [6]
@dnephin 👋 sorry for the direct ping, just wanted to make sure you didn't miss this PR. Do you have any feedback on whether this is good to be merged or if you'd like to see any changes? 🙇