2014-07-15 02:49:49 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
die () { echo $@ ; exit 1; }
|
|
|
|
|
|
|
|
. ../../nvm.sh
|
|
|
|
|
|
|
|
nvm_has_system_node() { return 0; }
|
2015-04-13 01:59:17 +08:00
|
|
|
nvm_print_npm_version() { return ' (npm v1.2.3)'; }
|
|
|
|
EXPECTED_OUTPUT="Now using system version of node: $(node -v)$(nvm_print_npm_version)"
|
|
|
|
[ "$(nvm use system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Could not use system version of node"
|
2014-07-15 02:49:49 +08:00
|
|
|
|
|
|
|
nvm_has_system_node() { return 1; }
|
2015-04-13 01:59:17 +08:00
|
|
|
nvm_print_npm_version() { return ''; }
|
|
|
|
EXPECTED_OUTPUT="System version of node not found."
|
|
|
|
[ "$(nvm use system 2>&1 | tail -n1)" = "$EXPECTED_OUTPUT" ] || die "Did not report error, system node not found"
|
2014-07-15 02:49:49 +08:00
|
|
|
nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
|
|
|
|
|