Skip to content

NVM_NOUSE on install.sh to pass --no-use to nvm.sh #2132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ nvm_do_install() {

# Source nvm
# shellcheck source=/dev/null
\. "$(nvm_install_dir)/nvm.sh"
if [ -z "${NVM_NOUSE-}" ] ; then
\. "$(nvm_install_dir)/nvm.sh"
else
\. "$(nvm_install_dir)/nvm.sh" --no-use
fi

nvm_check_global_modules

Expand Down
23 changes: 21 additions & 2 deletions test/install_script/nvm_do_install
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/sh

setup () {
#nvm_do_install is available
type nvm_do_install > /dev/null 2>&1 || die 'nvm_do_install is not available'
}

cleanup () {
unset NVM_ENV
unset NVM_NOUSE
rm -rf "$NVM_DIR/lib" >/dev/null 2>&1
}

die () { echo "$@" ; exit 1; }

#nvm install
NVM_ENV=testing \. ../../install.sh

#nvm_do_install is available
type nvm_do_install > /dev/null 2>&1 || die 'nvm_do_install is not available'
setup

cleanup

#nvm install --no-use
NVM_NOUSE=true
NVM_ENV=testing \. ../../install.sh > /dev/null

setup