Problem
--output <format> accepts exactly one value: tap (bashunit test --help, parsed at src/main/test.sh:72). Every other machine-readable format is file-only (--report-json, --report-junit, --report-tap, --report-html).
That forces a temp file into any pipeline that wants to post-process results:
./bashunit tests/ --report-json /tmp/r.json >/dev/null && jq '.tests[]|select(.status=="failed")' /tmp/r.json
when it should be:
./bashunit tests/ --output json | jq '.tests[]|select(.status=="failed")'
The formats and the writers already exist; only the destination is hard-coded.
Proposal
Extend --output to text (default) | tap | json | junit.
Where to change
src/main/test.sh:72 (--output parsing) and src/main/validate.sh:60 (value validation).src/main/run.sh:132-150 — the reporters currently take a file path; give them a stdout path, or write to /dev/stdout consistently.src/reports/json.sh, src/reports/junit.sh, src/reports/tap.sh.src/console/* — the suppression switch that tap already uses.
Acceptance criteria
Repo checklist (agent)
- TDD: RED → GREEN → REFACTOR. Write the failing test first.
- Bash 3.0+ only: no
printf -v, no += append, no declare -A, no [[ ]], no ${var,,}, no &>>, no ${arr[-1]}. Expanding a possibly-empty array under set -u needs ${arr[@]+"${arr[@]}"}. - A new CLI flag must be wired in all of these or a parity test fails:
- Gates:
make sa, make lint, ./bashunit tests/, ./bashunit --parallel tests/. Never run shfmt -w. - Docs: update
docs/command-line.md. Editing docs/assertions.md invalidates the bashunit doc acceptance snapshot — regenerate it. - CHANGELOG.md: add one line under
## Unreleased. - Fixtures under
tests/acceptance/fixtures/ must not end in *test.sh. - One issue = one PR.
Problem
--output <format>accepts exactly one value:tap(bashunit test --help, parsed atsrc/main/test.sh:72). Every other machine-readable format is file-only (--report-json,--report-junit,--report-tap,--report-html).That forces a temp file into any pipeline that wants to post-process results:
when it should be:
The formats and the writers already exist; only the destination is hard-coded.
Proposal
Extend
--outputtotext(default) |tap|json|junit.textformats send the report to stdout and suppress the human-readable console rendering, exactly as--output tapdoes today.--output jsonand--report-json f.jsonin the same run are allowed and both are produced.Where to change
src/main/test.sh:72(--outputparsing) andsrc/main/validate.sh:60(value validation).src/main/run.sh:132-150— the reporters currently take a file path; give them a stdout path, or write to/dev/stdoutconsistently.src/reports/json.sh,src/reports/junit.sh,src/reports/tap.sh.src/console/*— the suppression switch thattapalready uses.Acceptance criteria
--output jsonemits a single JSON document on stdout, valid perjq .--output junitemits XML on stdout--output tapis byte-identical to today (no regression)--output textequals no flag--output json --report-json f.jsonproduces both--parallel(regression guard for fix(reports): every report format is empty under --parallel #1004)Repo checklist (agent)
printf -v, no+=append, nodeclare -A, no[[ ]], no${var,,}, no&>>, no${arr[-1]}. Expanding a possibly-empty array underset -uneeds${arr[@]+"${arr[@]}"}.src/main/test.sh(report-style flags needexport -n, seesrc/main/test.sh:188-196for why)bashunit::main::validate_config_or_exit(src/main/validate.sh:60) — unvalidated input used to run the wrong thing and exit 0 (Unknown options are silently ignored: a typo'd flag runs a different suite and exits 0 #871, --jobs with a non-integer value hangs on Bash 3.x and is silently ignored on Bash 4.3+ #873)src/config/env.shand a documented line in.env.example--helptext in the same block it belongs tocompletions/bashunit.bashandcompletions/_bashunit(anti-drift test feat(cli): bash and zsh completion scripts with an anti-drift test #778 fails otherwise)make sa,make lint,./bashunit tests/,./bashunit --parallel tests/. Never runshfmt -w.docs/command-line.md. Editingdocs/assertions.mdinvalidates thebashunit docacceptance snapshot — regenerate it.## Unreleased.tests/acceptance/fixtures/must not end in*test.sh.