Release 0.34.0
🔧 New features
Watch mode
Automatically re-run tests whenever source files change. Uses inotifywait on Linux or fswatch on macOS:
bash
bashunit watch tests/
# or as a flag
bashunit --watch tests/If the required file-watching tool is not installed, bashunit provides a clear installation hint.
Test tags
Filter tests by # @tag annotations using --tag and --exclude-tag:
bash
# @tag slow
function test_heavy_computation() {
...
}
# @tag integration
function test_api_call() {
...
}bash
bashunit --tag slow tests/
bashunit --exclude-tag integration tests/Date comparison assertions
A full suite of date assertions with automatic format detection (epoch seconds, ISO 8601, space-separated datetime, and timezone offsets):
assert_date_equals- two dates represent the same point in timeassert_date_before/assert_date_after- chronological orderingassert_date_within_range- date falls between two boundsassert_date_within_delta- date is within N seconds of a reference
JSON assertions
Validate JSON output using jq under the hood:
assert_json_key_exists- a key is present in the JSONassert_json_contains- JSON contains a key-value pairassert_json_equals- full JSON equality check
Duration assertions
Measure how long a function takes to execute:
assert_duration- execution finishes in exactly N secondsassert_duration_less_than- execution finishes under N secondsassert_duration_greater_than- execution takes at least N seconds
More assertion power
assert_have_been_called_nth_with- verify spy arguments on a specific invocationassert_string_matches_format/assert_string_not_matches_format- match strings against format placeholders (%d,%s,%f,%i,%x,%e,%%)- TAP version 13 output format via
--output tapfor CI/CD integration --jobs Nflag to limit parallel test concurrency- Source context display in failure summaries showing the relevant assertion lines
⚡ Performance
This release includes significant performance optimizations reducing subprocess overhead across the board:
- Cache function discovery to avoid duplicate pipelines per test file
- Reduce subshells in the test execution hot path
- Batch coverage recording with in-memory buffering
- Cache
unameresult at source time to eliminate repeated subprocess forks - Replace
bcandawksubprocesses with native bash arithmetic in clock and duration formatting - Cache
base64 -wflag support at load time instead of detecting per test - Use direct variable access for assertion state instead of getter subshells in the runner hot path
🐛 Bug fixes
- Fix misleading error message for
assert_not_sameandassert_not_equalson failure - Mocking
mktempno longer breaks spy creation - JUnit XML report now conforms to the standard schema
- Proper
<failure>/<skipped>child elements,errors="0"attribute - Convert
timevalues from milliseconds to seconds (float) - Strip ANSI escape sequences and invalid XML control characters
- Proper
See the full changelog on GitHub