diff --git a/main_test.go b/main_test.go index 94dfd9d8..229e8c81 100644 --- a/main_test.go +++ b/main_test.go @@ -131,9 +131,10 @@ func run_bats_file(t *testing.T, dir, filename string) { cmd.Stdout = &stdout cmd.Stderr = &stderr - // Add dir to front of path - path := os.Getenv("PATH") - cmd.Env = append(cmd.Environ(), fmt.Sprintf("PATH=%s:%s", dir, path)) + // Add dir to asdf test variables + asdf_test_home := fmt.Sprintf("HOME=%s/.asdf/", dir) + asdf_bin_path := fmt.Sprintf("ASDF_BIN=%s", dir) + cmd.Env = append(cmd.Environ(), asdf_bin_path, asdf_test_home) err := cmd.Run() if err != nil { diff --git a/test/test_helpers.bash b/test/test_helpers.bash index 6f4468e1..e693e534 100644 --- a/test/test_helpers.bash +++ b/test/test_helpers.bash @@ -12,13 +12,15 @@ setup_asdf_dir() { BASE_DIR="$(mktemp -dt "asdf with spaces.XXXX")" fi - HOME="$BASE_DIR/home" + # HOME is now defined by the Golang test code in main_test.go + #HOME="$BASE_DIR/home" ASDF_DIR="$HOME/.asdf" mkdir -p "$ASDF_DIR/plugins" mkdir -p "$ASDF_DIR/installs" mkdir -p "$ASDF_DIR/shims" mkdir -p "$ASDF_DIR/tmp" - ASDF_BIN="$(dirname "$BATS_TEST_DIRNAME")/bin" + # ASDF_BIN is now defined by the Golang test code in main_test.go + #ASDF_BIN="$(dirname "$BATS_TEST_DIRNAME")/bin" # shellcheck disable=SC2031 PATH="$ASDF_BIN:$ASDF_DIR/shims:$PATH"