From 44274d6637fba24128b7e988b899af0caa3698ef Mon Sep 17 00:00:00 2001 From: Scanner Date: Tue, 11 Aug 2026 09:57:24 -0400 Subject: [PATCH] [scanner] fix: detect Vitest unhandled-rejection errors in unit-test.sh (#22004) The nightly unit-test regression (#22004) was caused by Vitest reporting 'Errors N errors' (unhandled rejections from fake-timer tests) even when all test cases themselves passed. The pass-through guard in unit-test.sh only checked for 'Tests.*failed', so a run with unhandled rejections could exit non-zero but still be incorrectly treated as a worker cleanup timeout. Add a guard that also fails when Vitest reports one or more errors, ensuring unhandled rejections (e.g. from fake-timer tests without expectEventualRejection) are caught and surface as real failures rather than being silently swallowed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Scanner --- scripts/unit-test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/unit-test.sh b/scripts/unit-test.sh index ff2767a365..10b8b0522c 100755 --- a/scripts/unit-test.sh +++ b/scripts/unit-test.sh @@ -97,7 +97,10 @@ fi if [ "$EXIT_CODE" -ne 0 ]; then # Check if all tests actually passed despite the non-zero exit - if grep -q "Tests.*passed" "$OUTPUT_FILE" && ! grep -q "Tests.*failed" "$OUTPUT_FILE"; then + # Also guard against Vitest reporting "Errors N errors" (unhandled rejections) + # even when no test cases failed — those errors caused the nightly regression in + # #22004 and must not be silently swallowed. (#22004) + if grep -q "Tests.*passed" "$OUTPUT_FILE" && ! grep -q "Tests.*failed" "$OUTPUT_FILE" && ! grep -qE "Errors +[1-9][0-9]* errors" "$OUTPUT_FILE"; then # All tests passed — exit was likely a pool worker termination timeout echo "" echo "All tests passed (exit code $EXIT_CODE was a non-test error, e.g. worker cleanup timeout)"