Skip to content

Bats stalls before listing tests on macOS

Source: Troubleshooting reference

Symptom: Validation prints Fast Bats tests, then stops before the test count. A bats-preprocess process remains idle.

Observed cause: On macOS with Homebrew Bash 5.3.15, a process sample showed bats-preprocess blocked in heredoc_write → write while preparing a here-string. This is a shell redirection stall before test execution; it does not indicate a failing test.

Confirm: Inspect the command and sample the affected PID:

Terminal window
ps -axo pid,ppid,etime,command | rg bats-preprocess
macprof sample PID 2 -o - --keep-idle

Workaround: Use Bash’s temporary-file redirection behavior for this invocation:

Terminal window
BASH_COMPAT=50 bats --count tests/agents.bats
BASH_COMPAT=50 ./tests/ci.sh full
# Or apply the same setting to the required outgoing-commit gate:
BASH_COMPAT=50 git push origin main

The count returned 22 on the affected checkout. The full gate still must pass. Keep this setting local to the command; compatibility mode changes other Bash semantics too. See the Bash maintainer’s explanation of here-document compatibility.