From a567d5bf0e7d207412796bbc4c8ff6c0ece6f331 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Wed, 3 Jun 2026 13:10:54 +0200 Subject: [PATCH] test(coverage): skip subshell-tracking tests on macOS The DEBUG-trap + set -T recorder does not propagate into subshells on the macOS system Bash (3.2), so these edge-case tests recorded 0 hits and failed locally on macOS while passing on Linux for all supported Bash. Skip them on Darwin (matching the existing Git Bash skip) and rename the guard to _skip_when_unsupported_context. --- tests/unit/coverage_subshell_test.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit/coverage_subshell_test.sh b/tests/unit/coverage_subshell_test.sh index 2f60372e..c3f0102d 100644 --- a/tests/unit/coverage_subshell_test.sh +++ b/tests/unit/coverage_subshell_test.sh @@ -20,7 +20,7 @@ _ORIG_COVERAGE_EXCLUDE="" # /tmp to deadlock CI runners. The contracts tested here are # deterministic in single-process mode, so the parallel run is not # a useful execution context. -function _skip_when_parallel_or_windows() { +function _skip_when_unsupported_context() { if [ "${BASHUNIT_PARALLEL_RUN:-false}" = "true" ]; then bashunit::skip "subshell tracking tests require single-process execution" return 0 @@ -30,6 +30,12 @@ function _skip_when_parallel_or_windows() { bashunit::skip "DEBUG trap + set -T behavior is unstable on Git Bash" return 0 ;; + Darwin*) + # The DEBUG-trap recorder does not propagate into subshells on the + # macOS system Bash (3.2); this works on Linux for all supported Bash. + bashunit::skip "DEBUG trap + set -T does not reach subshells on macOS Bash" + return 0 + ;; esac return 1 } @@ -105,7 +111,7 @@ function _run_fixture_under_coverage() { } function test_coverage_records_lines_inside_command_substitution() { - _skip_when_parallel_or_windows && return 0 + _skip_when_unsupported_context && return 0 local fixture fixture=$(mktemp) cat >"$fixture" <<'EOF' @@ -125,7 +131,7 @@ EOF } function test_coverage_records_explicit_subshell_block() { - _skip_when_parallel_or_windows && return 0 + _skip_when_unsupported_context && return 0 local fixture fixture=$(mktemp) cat >"$fixture" <<'EOF' @@ -147,7 +153,7 @@ EOF } function test_coverage_records_pipeline_lhs() { - _skip_when_parallel_or_windows && return 0 + _skip_when_unsupported_context && return 0 local fixture fixture=$(mktemp) cat >"$fixture" <<'EOF' @@ -165,7 +171,7 @@ EOF } function test_coverage_records_process_substitution_consumer() { - _skip_when_parallel_or_windows && return 0 + _skip_when_unsupported_context && return 0 local fixture fixture=$(mktemp) cat >"$fixture" <<'EOF' @@ -186,7 +192,7 @@ EOF } function test_coverage_records_lines_inside_function_called_from_subshell() { - _skip_when_parallel_or_windows && return 0 + _skip_when_unsupported_context && return 0 local fixture fixture=$(mktemp) cat >"$fixture" <<'EOF'