Also unset DATA_DIR and CONFIG_FILE during test

Like ASDF_DIR, these two are also likely to be set by user's login
shell, especially the shimmed `bats` (which calls `asdf_cmd()`) command
will eventually set them to user's actual in-use ones, causing conflicts
with the temporary test setup.
This commit is contained in:
bootleq 2024-02-18 13:44:51 +08:00
parent c5116dca60
commit a08dd7c5f4

View File

@ -3,6 +3,11 @@ setup_suite() {
# tests fail when it is set to something other than the temp dir. # tests fail when it is set to something other than the temp dir.
unset ASDF_DIR unset ASDF_DIR
# Also unset below variables, because in users shell shimmed commands
# (include bats) export them by determining user's real HOME.
unset ASDF_DATA_DIR
unset ASDF_CONFIG_FILE
# Set an agnostic Git configuration directory to prevent personal # Set an agnostic Git configuration directory to prevent personal
# configuration from interfering with the tests # configuration from interfering with the tests
export GIT_CONFIG_GLOBAL=/dev/null export GIT_CONFIG_GLOBAL=/dev/null