I forgot that this tool apparently only parses go test -v, not go test without -v. But the error handling of this is abysmal! It simply reports 0 failures.
$ docker run golang:1.13 bash -c 'GO111MODULE=off go get -u github.com/jstemmer/go-junit-report
cd /tmp
cat > broken_test.go <<!
package main
import "testing"
func TestAlwaysFail(t *testing.T) {
t.FailNow()
}
!
go test .
go test . | go-junit-report
'
Unable to find image 'golang:1.13' locally
1.13: Pulling from library/golang
376057ac6fa1: Already exists
5a63a0a859d8: Already exists
496548a8c952: Already exists
2adae3950d4d: Already exists
039b991354af: Already exists
036abadca78f: Pull complete
0514917ef7dc: Pull complete
Digest: sha256:c56dbb28a169f9bccdf398dc9d4bc8d41463352843dbcf03b6ef2fb3472c1794
Status: Downloaded newer image for golang:1.13
--- FAIL: TestAlwaysFail (0.00s)
FAIL
FAIL _/tmp 0.002s
FAIL
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite tests="0" failures="0" time="0.002" name="_/tmp">
<properties>
<property name="go.version" value="go1.13.12"></property>
</properties>
</testsuite>
</testsuites>
I forgot that this tool apparently only parses
go test -v
, notgo test
without-v
. But the error handling of this is abysmal! It simply reports 0 failures.vs working:
Could we detect when it's in the wrong format and throw an error?