2016-06-27 04:57:01 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2016-06-27 04:57:01 +08:00
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2016-06-27 04:57:01 +08:00
|
|
|
|
|
|
|
nvm unalias default >/dev/null 2>&1 || die 'unable to unalias default'
|
|
|
|
|
|
|
|
set +ex # needed for stderr
|
|
|
|
OUTPUT="$(nvm install --lts 3 2>&1)"
|
|
|
|
set -ex
|
|
|
|
EXIT_CODE="$(nvm install --lts 3 >/dev/null 2>&1 && echo $? || echo $?)"
|
|
|
|
EXPECTED_OUTPUT="Version '3' (with LTS filter) not found - try \`nvm ls-remote --lts\` to browse available versions."
|
|
|
|
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts 3\` did not exit with 3, got >${EXIT_CODE}<"
|
|
|
|
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
|
|
|
|
|
|
|
|
set +ex # needed for stderr
|
|
|
|
OUTPUT="$(nvm install --lts=argon 3 2>&1)"
|
|
|
|
set -ex
|
|
|
|
EXIT_CODE="$(nvm install --lts=argon 3 >/dev/null 2>&1 && echo $? || echo $?)"
|
|
|
|
EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls-remote --lts=argon\` to browse available versions."
|
|
|
|
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<"
|
|
|
|
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
|
|
|
|
|
|
|
|
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
|
|
|
|
|
|
|
|
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"
|