Release 0.20
🐛 Bugfix
Test doubles used in subshells
Assertions on spies now work even when the call happens inside a subshell.
bash
function test_spy_in_subshell() {
spy date
(
date
)
assert_have_been_called date
}
🔧 New features
Interpolating arguments in test names
Data providers can now interpolate their arguments directly into the test name. Combine it with the new @
prefix to improve readability.
bash
# @data_provider fizz_numbers
function test_returns_fizz_when_multiple_of_::1::_like_::2::_given() {
# ...
}
function fizz_numbers() {
echo 3 4
echo 3 6
}
Running example_test.sh
✓ Passed: Returns fizz when multiple of '3' like '4' given
✓ Passed: Returns fizz when multiple of '3' like '6' given
New assertions for test doubles
You can ensure that a spy was not executed using assert_not_called
and check arguments for specific invocations with an optional index in assert_have_been_called_with
.
bash
function test_success() {
spy ps
ps foo
ps bar
assert_have_been_called_with "foo" ps 1
assert_have_been_called_with "bar" ps 2
assert_not_called ls
}
Snapshot comparison ignoring colors
assert_match_snapshot_ignore_colors
allows validating colored output without caring about ANSI codes.
bash
function test_success() {
assert_match_snapshot_ignore_colors "$(printf '\e[31mHello\e[0m World!')"
}
Parallel tests on Windows
Parallel execution is now enabled on Windows, greatly reducing running time for large suites.
🌾 Miscellaneous
- Deprecate
# data_provider
in favor of# @data_provider
- Improve
find_total_tests
andrunner::parse_result_sync
performance
See the full changelog in GitHub