added junit.xml output

This commit is contained in:
Erik Brakkee 2024-11-19 19:52:24 +01:00
parent 568b230e21
commit 24b469c511
2 changed files with 20 additions and 2 deletions

View File

@ -19,10 +19,16 @@ vet: fmt
go vet ./...
test: build
go test -count=1 ${TESTFLAGS} ./pkg/... ./cmd/...
mkdir -p testout
go test -count=1 -coverprofile=testout/coverage.out -json ${TESTFLAGS} ./pkg/... ./cmd/... 2>&1 | \
tee testout/tests.json | sh filtertestjson
go-junit-report < testout/tests.json > testout/junit.xml
integrationtest: build
go test -count=1 ${TESTFLAGS} ./integrationtest/...
mkdir -p testout
go test -count=1 ${TESTFLAGS} ./integrationtest/... -json 2>&1 | \
tee testou8t/integrationtests.json | sh filtertestjson
go-junit-report < testout/integrationtests.json > testout/integrationtest.xml
build: generate vet
mkdir -p bin

12
filtertestjson Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
jq -r '
select(.Action != "outputx") |
if .Action == "fail" then "❌ FAIL: \(.Package) \(.Test // "")"
elif .Action == "pass" then "✅ PASS: \(.Package) \(.Test // "")"
elif .Action == "run" then "▶️ RUN: \(.Package) \(.Test // "")"
else " \(.Output // "" | rtrimstr("\n") )"
end
'