Skip to content

Commit 2151866

Browse files
authored
feat(cli): add --report-junit as an alias of --log-junit (#711)
1 parent ff9587b commit 2151866

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- GitHub Action `args` input: when set, runs `bashunit <args>` after installing, so a workflow can install and run the suite in a single step
77
- Floating major tag for the GitHub Action: the release process now force-moves `v0` to each release, so workflows can pin `TypedDevs/bashunit@v0` to track the latest release within a major (#700)
88
- `bashunit init` now scaffolds a `.github/workflows/tests.yml` CI workflow using the official action (existing files are left untouched) (#702)
9+
- `--report-junit <file>` flag as an alias of `--log-junit`, for naming parity with `--report-html` (#705)
910

1011
### Changed
1112
- `install.sh` now verifies the release checksum by default (set `BASHUNIT_VERIFY_CHECKSUM=false` to opt out); it soft-skips with a warning when a checksum asset is unavailable unless verification was explicitly requested (#703)

docs/command-line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bashunit test tests/ --parallel --simple
6161
| `--exclude-tag <name>` | Skip tests with matching `@tag` (repeatable) |
6262
| `--output <format>` | Output format (`tap` for TAP version 13) |
6363
| `-w, --watch` | Watch files and re-run tests on change |
64-
| `--log-junit <file>` | Write JUnit XML report |
64+
| `--log-junit, --report-junit <file>` | Write JUnit XML report |
6565
| `--log-gha <file>` | Write GitHub Actions workflow-commands log |
6666
| `-j, --jobs <N>` | Run tests in parallel with max N concurrent jobs |
6767
| `-p, --parallel` | Run tests in parallel |

src/console_header.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Options:
108108
-f, --filter <name> Only run tests matching the name
109109
--tag <name> Only run tests with matching @tag (repeatable, OR logic)
110110
--exclude-tag <name> Skip tests with matching @tag (repeatable, exclude wins)
111-
--log-junit <file> Write JUnit XML report
111+
--log-junit, --report-junit <file> Write JUnit XML report
112112
-j, --jobs <N> Run tests in parallel with max N concurrent jobs
113113
-p, --parallel Run tests in parallel (unlimited concurrency)
114114
--no-parallel Run tests sequentially

src/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function bashunit::main::cmd_test() {
9292
set +o allexport
9393
shift
9494
;;
95-
--log-junit)
95+
--log-junit | --report-junit)
9696
export BASHUNIT_LOG_JUNIT="$2"
9797
shift
9898
;;

tests/acceptance/bashunit_log_junit_test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@ function test_bashunit_when_log_junit_env() {
2020
assert_file_exists log-junit.xml
2121
rm log-junit.xml
2222
}
23+
24+
function test_bashunit_report_junit_is_alias_of_log_junit() {
25+
local test_file=./tests/acceptance/fixtures/test_bashunit_when_log_junit.sh
26+
local report=report-junit-alias.xml
27+
28+
# The fixture contains failing tests by design, so the run exits non-zero;
29+
# swallow it (we only care that --report-junit produced the file).
30+
./bashunit --no-parallel --env "$TEST_ENV_FILE" --report-junit "$report" "$test_file" >/dev/null 2>&1 || true
31+
assert_file_exists "$report"
32+
assert_file_contains "$report" "<testsuite"
33+
rm "$report"
34+
}

0 commit comments

Comments
 (0)