Skip to content

#49: feat: add JUnit XML report output - #66

Merged
sleipi merged 10 commits into
mainfrom
feat/49-junit-report
Oct 13, 2026
Merged

sleipi merged 10 commits into
mainfrom
feat/49-junit-report

Conversation

@sleipi

@sleipi sleipi commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Adds --report junit:<path>, so CI systems can show clitest results (GitLab, Jenkins and Azure DevOps read it natively, GitHub via dorny/test-reporter).

  • One test suite per file, one test case per entry. The case name is the first comment line, or the command when the entry has no comment.
  • Skipped entries, entries cancelled by --fail-fast, failed later asserts, failed [finally] sections and parse errors are in the report. Defer entries are not, because they are cleanup.
  • Only junit is supported. The format:path value leaves room for more formats later, for example CTRF.
  • Side change: later and finally failures now go through one code path, so each failure keeps its kind.
  • The report file is written with 0644 instead of the 0600 that gosec asks for, so a host runner can read a report written inside a container. This is the first nolint in the repo.

Not yet checked by hand with dorny/test-reporter.

Closes #49

Write a JUnit XML file with --report junit:PATH so CI systems can show test results. One testsuite per file, one testcase per entry, named after the first comment line or the command. Skipped and fail-fast-cancelled entries, failed later asserts and finally sections, and parse errors are included; defer entries are left out.

Closes #49
@sleipi sleipi added the enhancement New feature or request label Oct 13, 2026
Background entries with the same command got the name of the last one,
because the name was looked up by command string. Later and finally
results now carry their entry.
Entries without a comment are named after their command, which already
holds the substituted --var values. The header shows only var names on
purpose, and CI artifacts are not masked, so the report now shows
{{NAME}} instead of the value.
An unusable report path was only found after the whole run, and turned
a test-failure exit 1 into exit 2. The report file is now created before
the run, so a bad path exits 2 right away. A second --report flag is
rejected instead of silently replacing the first.
An entry with a skip directive was reported as cancelled by fail-fast and
lost its reason. Compact mode also kept the output of every entry in
memory until the end of the run, even without --report.
Suites used the display path, which is relative to the scanned
directory. Files with the same name in different directories got the
same suite name and classname, and the name did not match the path in
parse errors. CI tools can now also link the suite to the repo file.
Mutation testing showed 13 of 31 mutations surviving. New tests cover
the verbose path with --report, a skipped file with a defer entry,
suite and total durations, the parse error body, a failing write, and
the skip reason of a single entry.
Describe path handling, early failure, name masking and collisions,
and add GitHub Actions and GitLab CI snippets.
@sleipi
sleipi merged commit 68ec8bd into main Oct 13, 2026
7 checks passed
@sleipi
sleipi deleted the feat/49-junit-report branch October 13, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: JUnit XML report output (--report flag)

1 participant