Report skipped checks separately in shell tests

This commit is contained in:
David Heinemeier Hansson committed 2026-09-21 11:49:32 +02:00
1 parent 961ec7f39f
commit 599a6a665b
33 files changed
+147 -48

No files matched your search

+17 -2
View File
@@ -21,16 +21,31 @@ fi
# Keep going after a failing file. A test file exits at its first failed
# assertion, so aborting the run there too would hide every file after it --
# one packaging failure was masking 114 of 134 files.
output=$(mktemp)
trap 'rm -f "$output"' EXIT
failed=()
skipped=()
for test in "${tests[@]}"; do
printf '==> %s\n' "${test#$ROOT/}"
bash "$test" || failed+=("${test#$ROOT/}")
bash "$test" | tee "$output" || failed+=("${test#$ROOT/}")
if grep -q '^ok - .* # SKIP$' "$output"; then
skipped+=("${test#$ROOT/}")
fi
done
if (( ${#skipped[@]} > 0 )); then
printf '\nSkipped checks in %d of %d test files:\n' "${#skipped[@]}" "${#tests[@]}"
printf ' %s\n' "${skipped[@]}"
fi
if (( ${#failed[@]} > 0 )); then
printf '\n%d of %d test files failed:\n' "${#failed[@]}" "${#tests[@]}" >&2
printf ' %s\n' "${failed[@]}" >&2
exit 1
fi
printf '\nAll %d test files passed.\n' "${#tests[@]}"
if (( ${#skipped[@]} == 0 )); then
printf '\nAll %d test files passed.\n' "${#tests[@]}"
else
printf '\n%d test files completed without failures; %d had skipped checks.\n' "${#tests[@]}" "${#skipped[@]}"
fi