[Tests] `nvm install --lts`: add tests

Jordan Harband 2016-06-26 13:57:01 -07:00
parent e6606458f7
commit 655830eb58
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
2 changed files with 32 additions and 0 deletions

View File

@ -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)"

View File

@ -3,6 +3,7 @@
. ../../nvm.sh
nvm deactivate
nvm uninstall v0.10.7
nvm uninstall v4.2.2
if [ -f ".nvmrc" ]; then
rm .nvmrc