Ensuring BASH_IT is set before running tests

pull/687/head
Travis Swicegood 2016-03-25 17:46:46 -05:00 committed by Konstantin Gredeskoul
parent 8c5ec75898
commit fc70767315
1 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PATH=$PATH:$(pwd)/bats/bin test_directory="$(cd "$(dirname "$0")" && pwd)"
set +e bats_executable="${test_directory}/../bats/bin/bats"
[[ -z "$(which bats)" ]] && git clone --depth 1 https://github.com/sstephenson/bats.git
set -e [ ! -e $bats_executable ] && \
exec ./bats/bin/bats ${CI:+--tap} ./test/{lib,plugins} 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}