This commit is contained in:
Tobias Gurtzick 2017-08-27 02:41:17 +02:00
parent 4cdbdaead8
commit be18696701
No known key found for this signature in database
GPG Key ID: 6C56E4E3D2EAC901
3 changed files with 3 additions and 2 deletions

2
nvm.sh
View File

@ -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

View File

View File

@ -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'"