Skip to content

Commit

Permalink
[fix] Fix failing install tests
Browse files Browse the repository at this point in the history
  • Loading branch information
menaechmi committed Nov 12, 2024
1 parent cd22c84 commit 0eadeca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ nvm_detect_profile() {
if [ -z "$DETECTED_PROFILE" ]; then
for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc"
do
if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then
if DETECTED_PROFILE="$(nvm_try_profile "${ZDOTDIR:-${HOME}}/${EACH_PROFILE}")"; then
break
fi
done
Expand Down
8 changes: 4 additions & 4 deletions test/install_script/nvm_detect_profile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cleanup () {
unset -f setup cleanup die
unset ZDOTDIR
rm -f ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".profile" "test_profile" > "/dev/null" 2>&1
rm -rf zdot>&1
rm -rf zdotdir 2>&1
}

die () { echo "$@" '$NVM_DETECT_PROFILE:' "$NVM_DETECT_PROFILE"; cleanup; exit 1; }
Expand Down Expand Up @@ -94,21 +94,21 @@ fi
#

# It should favor .profile if file exists
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.profile" ]; then
die "nvm_detect_profile should have selected .profile"
fi

# Otherwise, it should favor .bashrc if file exists
rm ".profile"
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then
die "nvm_detect_profile should have selected .bashrc"
fi

# Otherwise, it should favor .bash_profile if file exists
rm ".bashrc"
NVM_DETECT_PROFILE="$(unset SHELL; nvm_detect_profile)"
NVM_DETECT_PROFILE="$(unset SHELL; unset ZDOTDIR; nvm_detect_profile)"
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bash_profile" ]; then
die "nvm_detect_profile should have selected .bash_profile"
fi
Expand Down

0 comments on commit 0eadeca

Please sign in to comment.