Skip to content

Commit afecb07

Browse files
committed
Fail more gracefully if mandatory option is not correctly set
1 parent 5f38450 commit afecb07

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

hooks/command

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -euo pipefail
44

5+
if [[ -z "${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS:-}" ]]; then
6+
echo "🚨 Missing artifacts configuration for the plugin"
7+
exit 1
8+
fi
9+
510
PLUGIN_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)/.."
611
MAX_SIZE=1024 # in KB
712

tests/command.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ export annotation_input="tests/tmp/annotation.input"
148148

149149
assert_failure
150150

151-
assert_output --partial "BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS: unbound variable"
151+
assert_output --partial "Missing artifacts configuration for the plugin"
152+
refute_output --partial ":junit:"
152153
}
153154

154155
@test "fails if the annotation is larger than 1MB" {

0 commit comments

Comments
 (0)