mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 12:58:21 +08:00
@@ -6,6 +6,7 @@ WORK="$PWD/nvm_get_latest-work.$$"
|
||||
TEST_BIN="$WORK/bin"
|
||||
|
||||
cleanup() {
|
||||
unset -f curl wget
|
||||
rm -rf "$WORK"
|
||||
export PATH="$OLDPATH"
|
||||
}
|
||||
@@ -96,6 +97,17 @@ chmod +x "$TEST_BIN/wget"
|
||||
|
||||
export PATH="$TEST_BIN:$OLDPATH"
|
||||
|
||||
# shadowing shell functions, like aliases baked into a user's shell, must be
|
||||
# bypassed in favor of the executables on PATH (https://github.com/nvm-sh/nvm/issues/2923)
|
||||
curl() {
|
||||
echo >&2 'the shadowing curl function was called'
|
||||
return 1
|
||||
}
|
||||
wget() {
|
||||
echo >&2 'the shadowing wget function was called'
|
||||
return 1
|
||||
}
|
||||
|
||||
try nvm_get_latest
|
||||
[ "_$CAPTURED_STDOUT" = "_$EXPECTED_VERSION" ] \
|
||||
|| die "success path did not return version '$EXPECTED_VERSION', got '$CAPTURED_STDOUT'"
|
||||
|
||||
Reference in New Issue
Block a user