test/run: lint
parent
61e1d6aec2
commit
97ef5a8087
|
|
@ -122,6 +122,7 @@ plugins/available/zoxide.plugin.bash
|
||||||
# tests
|
# tests
|
||||||
#
|
#
|
||||||
test/plugins/alias-completion.plugin.bats
|
test/plugins/alias-completion.plugin.bats
|
||||||
|
test/run
|
||||||
test/test_helper.bash
|
test/test_helper.bash
|
||||||
test/test_helper_libs.bash
|
test/test_helper_libs.bash
|
||||||
|
|
||||||
|
|
|
||||||
23
test/run
23
test/run
|
|
@ -4,13 +4,12 @@ bats_executable="${test_directory}/../test_lib/bats-core/bin/bats"
|
||||||
|
|
||||||
git submodule init && git submodule update
|
git submodule init && git submodule update
|
||||||
|
|
||||||
if [ -z "${BASH_IT}" ]; then
|
if [[ -z "${BASH_IT}" ]]; then
|
||||||
declare BASH_IT
|
|
||||||
BASH_IT="$(cd "${test_directory}" && dirname "${PWD}")"
|
BASH_IT="$(cd "${test_directory}" && dirname "${PWD}")"
|
||||||
export BASH_IT
|
export BASH_IT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [[ -z "$1" ]]; then
|
||||||
test_dirs=("${test_directory}"/{bash_it,completion,install,lib,plugins,themes})
|
test_dirs=("${test_directory}"/{bash_it,completion,install,lib,plugins,themes})
|
||||||
else
|
else
|
||||||
test_dirs=("$1")
|
test_dirs=("$1")
|
||||||
|
|
@ -22,25 +21,23 @@ fi
|
||||||
# so we can run `bats` in parallel processing mode, which is a lot faster.
|
# so we can run `bats` in parallel processing mode, which is a lot faster.
|
||||||
if command -v parallel &> /dev/null \
|
if command -v parallel &> /dev/null \
|
||||||
&& parallel -V &> /dev/null \
|
&& parallel -V &> /dev/null \
|
||||||
&& { parallel -V 2> /dev/null | grep -q '^GNU\>'; }
|
&& { parallel -V 2> /dev/null | grep -q '^GNU\>'; }; then
|
||||||
then
|
|
||||||
# Expect to run at least on a dual-core CPU; slightly degraded performance
|
# Expect to run at least on a dual-core CPU; slightly degraded performance
|
||||||
# shouldn't matter otherwise.
|
# shouldn't matter otherwise.
|
||||||
declare -i -r test_jobs_default=2
|
declare -i -r test_jobs_default=2
|
||||||
|
# shellcheck disable=SC2155
|
||||||
declare -i -r test_jobs_effective="$(
|
declare -i -r test_jobs_effective="$(
|
||||||
if [ "${TEST_JOBS:-detect}" = "detect" ] \
|
if [[ "${TEST_JOBS:-detect}" = "detect" ]] \
|
||||||
&& command -v nproc &> /dev/null
|
&& command -v nproc &> /dev/null; then
|
||||||
then
|
|
||||||
nproc
|
nproc
|
||||||
elif [ -n "${TEST_JOBS}" ] \
|
elif [[ -n "${TEST_JOBS}" ]] \
|
||||||
&& [ "${TEST_JOBS}" != "detect" ]
|
&& [[ "${TEST_JOBS}" != "detect" ]]; then
|
||||||
then
|
|
||||||
echo "${TEST_JOBS}"
|
echo "${TEST_JOBS}"
|
||||||
else
|
else
|
||||||
echo ${test_jobs_default}
|
echo "${test_jobs_default}"
|
||||||
fi
|
fi
|
||||||
)"
|
)"
|
||||||
exec "$bats_executable" ${CI:+--tap} --jobs ${test_jobs_effective} \
|
exec "$bats_executable" "${CI:+--tap}" --jobs "${test_jobs_effective}" \
|
||||||
"${test_dirs[@]}"
|
"${test_dirs[@]}"
|
||||||
else
|
else
|
||||||
# Run `bats` in single-threaded mode.
|
# Run `bats` in single-threaded mode.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue