From 391e70ce3bb765fa3fc8ca00e6f1cd0626308a62 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Tue, 14 Jul 2026 13:00:53 +0200 Subject: [PATCH] test(assert): drop jq from flaky custom-assertion test The 'custom assertion with fail shows correct test name' test was the only one of its three siblings to shell out to jq, and the only one that flaked on the macOS CI runner (empty/mismatched captured output) while the two pure-bash siblings never did. Route the failure through bashunit::fail with a pure-bash json check so the test no longer depends on an external binary. --- tests/unit/custom_assertions_test.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/unit/custom_assertions_test.sh b/tests/unit/custom_assertions_test.sh index 4f42fe2c..c4cbc637 100644 --- a/tests/unit/custom_assertions_test.sh +++ b/tests/unit/custom_assertions_test.sh @@ -1,15 +1,19 @@ #!/usr/bin/env bash -# Custom assertion that uses fail internally +# Custom assertion that uses fail internally. +# jq-free on purpose: this scaffolding only needs to route a failure through +# bashunit::fail deterministically; depending on the external jq binary made the +# test flaky on the macOS CI runner while the pure-bash sibling tests never were. function _assert_valid_json() { local json="$1" - if ! echo "$json" | jq . >/dev/null 2>&1; then + case "$json" in + '{'*'}' | '['*']') bashunit::state::add_assertions_passed ;; + *) bashunit::fail "Invalid json: $json" return - fi - - bashunit::state::add_assertions_passed + ;; + esac } # Custom assertion that uses bashunit::assertion_failed