diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb98da2..b3b883d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,19 +38,27 @@ jobs: sudo ./bats-core/install.sh /usr/local fi - # Install bats-support and bats-assert in the test directory - mkdir -p tests/test_helper - cd tests/test_helper - if [ ! -d "bats-support" ]; then - git clone https://github.com/bats-core/bats-support.git --depth 1 + # Install bats-support and bats-assert in a standard location + BATS_HELPER_PATH="/usr/local/lib/bats-helpers" + sudo mkdir -p $BATS_HELPER_PATH + + # Clone and install bats-support + if [ ! -d "$BATS_HELPER_PATH/bats-support" ]; then + git clone https://github.com/bats-core/bats-support.git /tmp/bats-support --depth 1 + sudo mv /tmp/bats-support $BATS_HELPER_PATH/ fi - if [ ! -d "bats-assert" ]; then - git clone https://github.com/bats-core/bats-assert.git --depth 1 + + # Clone and install bats-assert + if [ ! -d "$BATS_HELPER_PATH/bats-assert" ]; then + git clone https://github.com/bats-core/bats-assert.git /tmp/bats-assert --depth 1 + sudo mv /tmp/bats-assert $BATS_HELPER_PATH/ fi - if [ ! -d "bats-file" ]; then - git clone https://github.com/bats-core/bats-file.git --depth 1 + + # Clone and install bats-file + if [ ! -d "$BATS_HELPER_PATH/bats-file" ]; then + git clone https://github.com/bats-core/bats-file.git /tmp/bats-file --depth 1 + sudo mv /tmp/bats-file $BATS_HELPER_PATH/ fi - cd ../../ - name: Set up SSH run: | diff --git a/tests/parser.bats b/tests/parser.bats index 267a685..553c845 100755 --- a/tests/parser.bats +++ b/tests/parser.bats @@ -1,9 +1,10 @@ #!/usr/bin/env bats # Load BATS helper libraries -load 'test_helper/bats-support/load' -load 'test_helper/bats-assert/load' -load 'test_helper/bats-file/load' +export BATS_LIB_PATH="/usr/local/lib/bats-helpers" +load "$BATS_LIB_PATH/bats-support/load.bash" +load "$BATS_LIB_PATH/bats-assert/load.bash" +load "$BATS_LIB_PATH/bats-file/load.bash" # Simple test for parse_volume function @test "parse_volume should parse volume string correctly" {