2016-07-03 23:37:03 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2016-07-03 23:37:03 +08:00
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../../nvm.sh
|
2016-07-03 23:37:03 +08:00
|
|
|
|
|
|
|
nvm deactivate >/dev/null 2>&1 || die 'deactivate failed'
|
|
|
|
|
|
|
|
nvm use --lts || die 'nvm use --lts failed'
|
|
|
|
OUTPUT="$(nvm current)"
|
|
|
|
EXPECTED_OUTPUT="$(nvm_resolve_alias 'lts/*')"
|
|
|
|
|
|
|
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
|
|
|
|| die "'nvm use --lts' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
|
|
|
|
|
|
|
OUTPUT="$(nvm use --silent --lts)"
|
|
|
|
EXPECTED_OUTPUT=""
|
|
|
|
|
|
|
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
|
|
|
|| die "'nvm use --silent --lts' output was not silenced '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|