From 518991598074e36665425cf9ddb152f95d4bbd3b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 18 Sep 2017 16:19:33 -0700 Subject: [PATCH] Skip sourcing nvm.sh if it's already available --- scripts/test.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 777e0700..133d18a0 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -232,12 +232,16 @@ cleanup trap cleanup EXIT # Use a consistent version of Node if possible. -if [ -f "$NVM_DIR/nvm.sh" ]; then - . "$NVM_DIR/nvm.sh" || true -elif [ -x "$(command -v brew)" ] && [ -f "$(brew --prefix nvm)/nvm.sh" ]; then - # we must be on mac and nvm was installed with brew - # TODO: change the mac slaves to use manual nvm installation - . "$(brew --prefix nvm)/nvm.sh" || true +if [[ -z "$(command -v nvm)" ]]; then + if [ -f "$NVM_DIR/nvm.sh" ]; then + . "$NVM_DIR/nvm.sh" || true + elif [ -x "$(command -v brew)" ] && [ -f "$(brew --prefix nvm)/nvm.sh" ]; then + # we must be on mac and nvm was installed with brew + # TODO: change the mac slaves to use manual nvm installation + . "$(brew --prefix nvm)/nvm.sh" || true + elif [ -f "$HOME/.nvm/nvm.sh" ]; then + . ~/.nvm/nvm.sh + fi fi if [[ "$(command -v nvm)" ]]; then nvm install 6.5.0