1emulate_bats_env() { 2 export BATS_CWD="$PWD" 3 export BATS_TEST_FILTER= 4 export BATS_ROOT_PID=$$ 5 export BATS_RUN_TMPDIR 6 BATS_RUN_TMPDIR=$(mktemp -d "${BATS_RUN_TMPDIR}/emulated-tmpdir-${BATS_ROOT_PID}-XXXXXX") 7} 8 9fixtures() { 10 FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/$1" 11 # shellcheck disable=SC2034 12 RELATIVE_FIXTURE_ROOT="${FIXTURE_ROOT#$BATS_CWD/}" 13} 14 15filter_control_sequences() { 16 "$@" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' 17} 18 19if ! command -v tput >/dev/null; then 20 tput() { 21 printf '1000\n' 22 } 23 export -f tput 24fi 25 26emit_debug_output() { 27 # shellcheck disable=SC2154 28 printf '%s\n' 'output:' "$output" >&2 29} 30 31run_under_clean_bats_env() { 32 # we want the variable names to be separate 33 # shellcheck disable=SC2086 34 unset ${!BATS_@} 35 "$@" 36} 37