mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-31 01:45:50 +08:00
[Fix] nvm ls, nvm alias, nvm install: error when an LTS name is invalid
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
@@ -56,6 +54,14 @@ printf '%s\n' "${LTS_LIST}" | while IFS= read -r LTS; do
|
||||
INDEX=$(($INDEX + 1))
|
||||
done
|
||||
|
||||
OUTPUT="$(nvm ls-remote lts/ARGON 2>&1)"
|
||||
EXIT_CODE=$?
|
||||
[ $EXIT_CODE -eq 3 ] || die "nvm ls-remote lts/ARGON did not exit 3, got '${EXIT_CODE}'"
|
||||
|
||||
EXPECTED_OUTPUT="LTS names must be lowercase
|
||||
N/A"
|
||||
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] || die "nvm ls-remote lts/ARGON did not output expected error message; got >${OUTPUT}< expected >${EXPECTED_OUTPUT}<"
|
||||
|
||||
REMOTE="${PWD}/mocks/nvm_ls_remote.txt"
|
||||
nvm_ls_remote() {
|
||||
cat "${REMOTE}"
|
||||
|
||||
Reference in New Issue
Block a user