[Tests] `nvm install --lts`: add tests
parent
e6606458f7
commit
655830eb58
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../nvm.sh
|
||||||
|
|
||||||
|
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}<"
|
||||||
|
|
||||||
|
set +e # TODO: fix
|
||||||
|
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"
|
|
@ -3,6 +3,7 @@
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm deactivate
|
nvm deactivate
|
||||||
nvm uninstall v0.10.7
|
nvm uninstall v0.10.7
|
||||||
|
nvm uninstall v4.2.2
|
||||||
|
|
||||||
if [ -f ".nvmrc" ]; then
|
if [ -f ".nvmrc" ]; then
|
||||||
rm .nvmrc
|
rm .nvmrc
|
||||||
|
|
Loading…
Reference in New Issue