From fc70767315e7680fb5bce31460b1c451043c3b48 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Fri, 25 Mar 2016 17:46:46 -0500 Subject: [PATCH] Ensuring BASH_IT is set before running tests --- test/run | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/run b/test/run index 6bc2f578..397aec9c 100755 --- a/test/run +++ b/test/run @@ -1,6 +1,12 @@ #!/usr/bin/env bash -PATH=$PATH:$(pwd)/bats/bin -set +e -[[ -z "$(which bats)" ]] && git clone --depth 1 https://github.com/sstephenson/bats.git -set -e -exec ./bats/bin/bats ${CI:+--tap} ./test/{lib,plugins} +test_directory="$(cd "$(dirname "$0")" && pwd)" +bats_executable="${test_directory}/../bats/bin/bats" + +[ ! -e $bats_executable ] && \ + git clone --depth 1 https://github.com/sstephenson/bats.git ${test_directory}/../bats + +if [ -z "${BASH_IT}" ]; then + export BASH_IT=$(cd ${test_directory} && dirname $(pwd)) +fi + +exec $bats_executable ${CI:+--tap} ${test_directory}/{lib,plugins}