mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
fix test
This commit is contained in:
parent
4cdbdaead8
commit
be18696701
2
nvm.sh
2
nvm.sh
@ -2112,7 +2112,7 @@ nvm_die_on_prefix() {
|
|||||||
if [ -f "${npmrc}/.npmrc" ]; then
|
if [ -f "${npmrc}/.npmrc" ]; then
|
||||||
NVM_NPM_PREFIX=$(grep ^prefix= "${npmrc}"/.npmrc | sed s/prefix=\\\(.*\\\)$/\\1/)
|
NVM_NPM_PREFIX=$(grep ^prefix= "${npmrc}"/.npmrc | sed s/prefix=\\\(.*\\\)$/\\1/)
|
||||||
if ! [ -z "$NVM_NPM_PREFIX" ]; then
|
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
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
0
test/fast/Unit tests/.npmrc
Normal file
0
test/fast/Unit tests/.npmrc
Normal file
@ -63,7 +63,8 @@ sed() {
|
|||||||
echo "./bad prefix"
|
echo "./bad prefix"
|
||||||
}
|
}
|
||||||
OUTPUT="$(nvm_die_on_prefix 0 foo 2>&1)"
|
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."
|
Run \`npm config delete prefix\` or \`foo\` to unset it."
|
||||||
EXIT_CODE="$(nvm_die_on_prefix 0 foo >/dev/null 2>&1; echo $?)"
|
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'"
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT' with bad prefix set; got '$OUTPUT'"
|
||||||
|
Loading…
Reference in New Issue
Block a user