Skip to content

Commit 434c978

Browse files
committed
Implemented option to fail if less than X tests are parsed
1 parent 1733543 commit 434c978

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

hooks/command

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ if [ $has_errors -eq 0 ]; then
7676
echo "Will create annotation anyways"
7777
create_annotation=1
7878
fi
79+
80+
if [[ -e "${annotation_path}" ]]; then
81+
TOTAL_TESTS=$(head -4 "${annotation_path}" | grep 'Total tests' | cut -d\ -f3)
82+
else
83+
TOTAL_TESTS=0
84+
fi
85+
86+
if [[ "${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_MIN_TESTS:-0}" -gt "${TOTAL_TESTS}" ]]; then
87+
create_annotation=1
88+
fail_build=1
89+
echo ":warning: Less than ${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_MIN_TESTS} tests run"
90+
fi
7991
elif ! check_size; then
8092
echo "--- :warning: Failures too large to annotate"
8193

0 commit comments

Comments
 (0)