Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions scripts/bash-test-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DEVBASE_LIB_DIR="$DIR/../shell/lib"

# shellcheck source=../shell/lib/mise/stub.sh
source "$DEVBASE_LIB_DIR/mise/stub.sh"
# shellcheck source=../shell/lib/bootstrap.sh
source "$DEVBASE_LIB_DIR"/bootstrap.sh

# shellcheck source=../shell/lib/logging.sh
source "$DEVBASE_LIB_DIR"/logging.sh

# shellcheck source=../shell/lib/shell.sh
source "$DEVBASE_LIB_DIR"/shell.sh

# Check if the bats test helpers are installed and usable.
if [[ ! -f "$DIR/bats/test_helper/bats-assert/load.bash" ]]; then
Expand All @@ -28,8 +34,10 @@ if in_ci_environment; then
extraArgs+=("--report-formatter" "junit" "--output" "$junitOutputPath")
fi

BATS_LIB_PATH="$DIR/bats/test_helper" mise_exec_tool bats "${extraArgs[@]}" "${test_files[@]}"
set +e
"$DIR"/bats.sh "${extraArgs[@]}" "${test_files[@]}"
exitCode=$?
set -e

# If we're running in CI, move the test-results to the path that gets
# uploaded. See shell/test.sh.
Expand Down
12 changes: 12 additions & 0 deletions scripts/bats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Wrapper for running bats in the context of devbase.

set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DEVBASE_LIB_DIR="$DIR/../shell/lib"

# shellcheck source=../shell/lib/mise/stub.sh
source "$DEVBASE_LIB_DIR/mise/stub.sh"

BATS_LIB_PATH="$DIR/bats/test_helper" mise_exec_tool bats "$@"