Skip to content

Examples

Test results

Single file:

trep test results.xml

Multiple files (merged into one report):

trep test -o report.html -t "PR #42" a.xml b.xml c.xml

From stdin (pipe from go test):

go test -json ./... | trep test - -t "Unit Tests"

Exit 1 on failure (for CI gates):

trep test --fail -q results.xml

One report per file (no merge):

trep test --no-merge suite1.xml suite2.xml
# → suite1.html + suite2_02.html


Coverage

Go coverprofile:

trep cov coverage.out

LCOV (gcov / Istanbul):

trep cov coverage.info

Cobertura / JaCoCo:

trep cov coverage.xml

Enforce 80% line coverage and fail if below:

trep cov --threshold 80 --fail coverage.out

Strip absolute CI runner paths:

trep cov --strip-prefix /home/runner/work/repo/ coverage.info

Exclude generated files:

trep cov --exclude "vendor/**" --exclude "**/*.pb.go" coverage.out


Combined report

Minimal (both files in current directory):

trep report --tests results.xml --cov coverage.out
# → report_tests.html + report_cov.html

Full CI invocation:

trep report \
  --tests unit.xml integration.xml \
  --cov coverage.info \
  --threshold 80 --fail-tests --fail-cov \
  --output-dir dist/ --prefix nightly \
  --title "Nightly CI" \
  --save-snapshot .trep/snap.json


Delta badges

# Run 1 — save snapshot on main branch
trep test --save-snapshot .trep/baseline.json results.xml

# Run 2 — compare against baseline on PR branch
trep test \
  --baseline .trep/baseline.json \
  --baseline-label "main" \
  results_new.xml
# → delta badges show +3 pass / -1 fail / +2.1% coverage etc.

CI annotations

# GitHub Actions: annotations appear as checks on the PR diff
trep test --annotate results.xml

# GitLab CI: explicit platform
trep test --annotate --annotate-platform gitlab results.xml

Output to stdout (for scripting)

# JSON to stdout, pipe to jq
trep test --output-format json -o - results.xml | jq '.summary'

# SARIF to file
trep test --output-format sarif -o results.sarif results.xml