Release 0.47.0
Release 0.47.0 lets you send reports directly to other commands, reuse settings for groups of tests, and control individual tests. Coverage, which reports how much code the tests reach, now includes tracked files that no test ran. Keep that change in mind when comparing percentages after an upgrade.
Send reports straight to another command
--output json and --output junit write a report to the normal terminal output, which you can pipe to another command or redirect to a file. You do not need a temporary report file. The existing options that write reports to files remain available alongside them (#1018).
bashunit tests/ --output json | jq '.summary'
bashunit tests/ --output junit > report.xmlNamed [suite:<name>] sections in .bashunitrc store paths and options for groups of tests. Use --suite <name> to select one group, repeat the option to combine groups, or use --list-suites to see available names (#1021).
bashunit --list-suites
bashunit --suite unitGive each test the settings it needs
The comments # @timeout, # @retry, and # @skip above a test set its time limit, retries, or skipped status. They override settings for the whole run. Invalid values stop the run instead of quietly using another setting. The new helpers for skipping a test under certain conditions both mark it skipped and end it, replacing a separate return (#1020, #1019).
--sandbox fails a test that runs an external command it did not replace with a test-controlled response, except commands already allowed by default. --sandbox-allow adds more allowed commands. To test code that retries, bashunit::mock_sequence supplies a different answer on each call and repeats the final answer after all the listed answers have been used (#1022, #1023).
Include files no test reached
Previously, coverage considered only files a test ran. Now it includes every file under --coverage-paths, with untouched files reported at zero coverage. Percentages may drop because the report includes more of the code. Reports limited to changed lines also include changed files that no test ran. A new untested file therefore cannot escape the minimum-percentage check (#1053, #1054).
Fixes to how bashunit reads alternatives in case statements and finds where functions begin and end also change coverage details. Preparing the report now uses one call to awk per run to identify executable lines and write the output, rather than repeating shell loops and starting processes for each file.
Runs that measure execution time can now save JSON and JUnit reports and compare the middle timing sample, called the median, against a saved reference. --snapshot-prune removes unused snapshots, the files holding saved expected output, only after a full run without failures. It prints each deleted path. Runs that select only some tests cannot remove them (#1029, #1030).
See the full changelog for 0.47.0 on GitHub.