Skip to content

feat(cli): --output json and --output junit to stdout - #1064

Merged
Chemaclass merged 1 commit into
mainfrom
feat/1018-output-json-junit-to-stdout
Aug 11, 2026
Merged

Chemaclass merged 1 commit into
mainfrom
feat/1018-output-json-junit-to-stdout

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1018

--output accepted only tap, so every other machine-readable format was file-only and a pipeline that wanted to post-process a run had to route it through a temp file. The formats and their writers already existed; only the destination was hard-coded.

💡 Changes

  • --output <text|tap|json|junit>: JSON and JUnit now render on stdout, and --output json --report-json f.json still produces both sinks.
  • Everything that is console rendering is suppressed for the machine formats — header, progress, summary, coverage and slowest-tests tables, GHA annotations, and the parallel spinner whose erase sequence used to precede the XML declaration.
  • Diagnostics stay on stderr (including the --coverage-min verdict, whose diff pass still runs), and exit codes follow the same ladder as the console renderer.
  • An unknown value now lists all four supported formats instead of only tap.

--output accepted only tap, so every other machine-readable format was
file-only and any pipeline that wanted to post-process a run had to go
through a temp file. The formats and their writers already existed; only
the destination was hard-coded.

--output now takes text (the default), tap, json or junit. The JSON and
JUnit writers are split into a print_* half that renders on stdout and a
generate_* half that redirects it into a file, so both sinks emit the
same document and --output json --report-json f.json produces both.

For every format but text the console rendering is suppressed: header,
progress, summary, per-file headers, hook lines, the coverage table, the
slowest-tests table and the GitHub Actions annotations, which would all
sit inside the document. The parallel spinner and the "\r  \r" that
erases it are suppressed too -- those bytes landed in front of the XML
declaration. --coverage-min still gates (the diff pass runs with its
table discarded) and reports its verdict on stderr.

Exit codes are unaffected: the machine branch of render_result walks the
same failed / flaky / no-tests-found ladder as the console renderer.

Closes #1018
@Chemaclass Chemaclass added the enhancement New feature or request label Aug 11, 2026
@Chemaclass Chemaclass self-assigned this Aug 11, 2026
@Chemaclass
Chemaclass merged commit 9fb6432 into main Aug 11, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the feat/1018-output-json-junit-to-stdout branch August 11, 2026 20:28
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.

1 participant