Skip to content

Commit 376b6db

Browse files
committed
plugin-tests.sh handles being sourced
1 parent d8dc444 commit 376b6db

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dev/plugin-tests.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ log() { printf -- "** %s\n" "$*" >&2; }
1919
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
2020
fatal() { error "$@"; exit 1; }
2121

22-
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22+
if [[ -n ${GITHUB_ACTIONS:=""} ]]; then
23+
# we will have been piped to bash and won't know the location of the script
24+
source_directory="$(pwd)"
25+
else
26+
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
27+
source_directory="$(readlink -f "${here}/..")"
28+
fi
2329
tests_directory="${PLUGIN_TESTS_OUTPUT_DIRECTORY:=$(mktemp -d)}"
2430

25-
PLUGIN_TESTS_OUTPUT_DIRECTORY="$tests_directory" "$here/setup-plugin-tests.sh"
26-
PLUGIN_TESTS_DIRECTORY="$tests_directory" "$here/execute-plugin-tests.sh"
31+
PLUGIN_TESTS_OUTPUT_DIRECTORY="$tests_directory" "${source_directory}/dev/setup-plugin-tests.sh"
32+
PLUGIN_TESTS_DIRECTORY="$tests_directory" "${source_directory}/dev/execute-plugin-tests.sh"

0 commit comments

Comments
 (0)