This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/bats_helpers.bash
Andrea Luzzardi 568cd194a4 tests: Basic test infrastructure for Europa Universe
- Each package can include its own bats file (e.g. `universe.dagger.io/yarn/test/yarn.bats`)
- universe.dagger.io includes a common bash helper file
- bats is installed/launched through yarn with minimal setup
- shellcheck is done across the entire repo
- Integrated into our CI

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2022-01-19 12:39:39 -08:00

26 lines
739 B
Bash

common_setup() {
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-support/load.bash"
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-assert/load.bash"
# Dagger Binary
# FIXME: `command -v` must be wrapped in a sub-bash,
# otherwise infinite recursion when DAGGER_BINARY is not set.
export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}"
# Force Europa mode
DAGGER_EUROPA="1"
export DAGGER_EUROPA
# Force plain printing for error reporting
DAGGER_LOG_FORMAT="plain"
export DAGGER_LOG_FORMAT
# cd into the directory containing the bats file
cd "$BATS_TEST_DIRNAME" || exit 1
}
# dagger helper to execute the right binary
dagger() {
"${DAGGER}" "$@"
}