From be1869670102b803e15db94215dfd8953f54ad8a Mon Sep 17 00:00:00 2001 From: Tobias Gurtzick Date: Sun, 27 Aug 2017 02:41:17 +0200 Subject: [PATCH] fix test --- nvm.sh | 2 +- test/fast/Unit tests/.npmrc | 0 test/fast/Unit tests/nvm_die_on_prefix | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 test/fast/Unit tests/.npmrc diff --git a/nvm.sh b/nvm.sh index d79a795..148ce02 100644 --- a/nvm.sh +++ b/nvm.sh @@ -2112,7 +2112,7 @@ nvm_die_on_prefix() { if [ -f "${npmrc}/.npmrc" ]; then NVM_NPM_PREFIX=$(grep ^prefix= "${npmrc}"/.npmrc | sed s/prefix=\\\(.*\\\)$/\\1/) if ! [ -z "$NVM_NPM_PREFIX" ]; then - nvm_err "Incompatible prefix setting prefix=${npmrc} found in the config file ${npmrc}/.npmrc" + nvm_err "Incompatible prefix setting prefix=${NVM_NPM_PREFIX} found in the config file ${npmrc}/.npmrc" break fi fi diff --git a/test/fast/Unit tests/.npmrc b/test/fast/Unit tests/.npmrc new file mode 100644 index 0000000..e69de29 diff --git a/test/fast/Unit tests/nvm_die_on_prefix b/test/fast/Unit tests/nvm_die_on_prefix index 95a5f60..90169de 100755 --- a/test/fast/Unit tests/nvm_die_on_prefix +++ b/test/fast/Unit tests/nvm_die_on_prefix @@ -63,7 +63,8 @@ sed() { echo "./bad prefix" } OUTPUT="$(nvm_die_on_prefix 0 foo 2>&1)" -EXPECTED_OUTPUT="nvm is not compatible with the npm config \"prefix\" option: currently set to \"./bad prefix\" +EXPECTED_OUTPUT="Incompatible prefix setting prefix=./bad prefix found in the config file ./.npmrc +nvm is not compatible with the npm config \"prefix\" option: currently set to \"./bad prefix\" Run \`npm config delete prefix\` or \`foo\` to unset it." EXIT_CODE="$(nvm_die_on_prefix 0 foo >/dev/null 2>&1; echo $?)" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT' with bad prefix set; got '$OUTPUT'"