File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88- Allow ` assert_have_been_called_with ` to check arguments of specific calls
99- Enable parallel tests on Windows
1010- Add ` assert_not_called `
11+ - Improve ` find_total_tests ` performance
1112
1213## [ 0.19.1] ( https://github.com/TypedDevs/bashunit/compare/0.19.0...0.19.1 ) - 2025-05-23
1314
Original file line number Diff line number Diff line change @@ -190,19 +190,18 @@ function helpers::get_latest_tag() {
190190function helpers::find_total_tests() {
191191 local filter=${1:- }
192192 local files=(" ${@: 2} " )
193- local total_count=0
194-
195- for file in " ${files[@]} " ; do
196- local count
197- if [[ -n " $filter " ]]; then
198- count=$( grep -r -E " ^\s*function\s+test.*$filter " " $file " --include=\* .sh 2> /dev/null | wc -l)
199- else
200- count=$( grep -r -E ' ^\s*function\s+test' " $file " --include=\* .sh 2> /dev/null | wc -l)
201- fi
202- total_count=$(( total_count + count))
203- done
204-
205- echo " $total_count "
193+
194+ if [[ ${# files[@]} -eq 0 ]]; then
195+ echo 0
196+ return
197+ fi
198+
199+ local pattern=' ^\s*function\s+test'
200+ if [[ -n " $filter " ]]; then
201+ pattern+=" .*$filter "
202+ fi
203+
204+ grep -r -E " $pattern " --include=" *.sh" " ${files[@]} " 2> /dev/null | wc -l | xargs
206205}
207206
208207function helper::load_test_files() {
You can’t perform that action at this time.
0 commit comments