reporter
Structured Go test failure reports
Parse go test output into structured failure reports. Auto-detects JSON or verbose format. Extracts test name, package, source location, and diagnostic output. Filters parent test noise.
Features
- Parses go test -json and go test -v output
- Extracts test name, package, source location
- Filters parent test noise - reports only leaf failures
- Structured JSON output
Install
go install github.com/hegner123/reporter@latestThe Problem: go test output is verbose and hard to parse
$ go test -v ./...
--- FAIL: TestUserCreate (0.02s)
--- FAIL: TestUserCreate/invalid_email (0.01s)
user_test.go:45: expected error for invalid email
got: nil
want: ErrInvalidEmail
--- FAIL: TestUserCreate/duplicate (0.01s)
user_test.go:67: unexpected error
got: context deadline exceeded
want: ErrDuplicate
FAIL
# Parent test (TestUserCreate) clutters the output.
# Source locations mixed with diagnostic text.
# AI agents waste tokens parsing this manually.Solution
$ go test -v ./... | reporter --cliOutput
{"failures":[{"test":"TestUserCreate/invalid_email","package":"myapp/pkg/users","file":"user_test.go","line":45,"message":"expected error for invalid email\ngot: nil\nwant: ErrInvalidEmail"},{"test":"TestUserCreate/duplicate","package":"myapp/pkg/users","file":"user_test.go","line":67,"message":"unexpected error\ngot: context deadline exceeded\nwant: ErrDuplicate"}],"total_tests":12,"passed":10,"failed":2}Comparison
| Metric | Value |
|---|---|
| Noise reduction | Filters parent tests, keeps only leaf failures |
| Formats | go test -json and go test -v |
| Output | Structured JSON with file + line numbers |