Skip to content
Myr

npm version: shell compatibility, test update

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Update test string that checks printed node version to pass with additional npm version display * Remove echo -n for compatibility with shells that do not support it

authored by Andrew Crites · committed by Andrew Crites · parent e01bcb7 · Browse files · 2 files+9 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−6 removed

  • tests:+1 added−1 removed
  • other:+8 added−5 removed

2 files+9 added−6 removed

modified:test/fast/Running "nvm use system" should work as expected+1 added-1 removed
3 unmodified lines
45. ../../nvm.sh67nvm_has_system_node() { return 0; }8[ "$(nvm use system 2>&1 | tail -n1)" = "Now using system version of node: $(node -v)." ] || die "Could not use system version of node"8[ "$(nvm use system 2>&1 | tail -n1)" = "Now using system version of node: $(node -v) (npm v$(npm -v))" ] || die "Could not use system version of node"910nvm_has_system_node() { return 1; }11[ "$(nvm use system 2>&1 | tail -n1)" = "System version of node not found." ] || die "Did not report error, system node not found"12nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
1 unmodified line
modified:nvm.sh+8 added-5 removed
1357 unmodified lines
1358 return 1271359 fi13601361 if [ "_$VERSION" = '_system' ]; then1362 local NPM_VERSION1363 NPM_VERSION="(npm v$(npm --version 2>/dev/null))"1364 if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then1363 echo "Now using system version of node: $(node -v 2>/dev/null) (npm v$(npm --version 2>/dev/null))"1365 echo "Now using system version of node: $(node -v 2>/dev/null) $NPM_VERSION"1366 return1367 elif nvm_has_system_iojs && nvm deactivate >/dev/null 2>&1; then1366 echo "Now using system version of io.js: $(iojs --version 2>/dev/null) (npm v$(npm --version 2>/dev/null))"1368 echo "Now using system version of io.js: $(iojs --version 2>/dev/null) $NPM_VERSION"1369 return1370 else1371 echo "System version of node not found." >&21372 return 127
34 unmodified lines
1407 export NVM_BIN="$NVM_VERSION_DIR/bin"1408 if [ "$NVM_SYMLINK_CURRENT" = true ]; then1409 command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"1410 fi1411 local NPM_VERSION1412 NPM_VERSION="(npm v$(npm --version 2>/dev/null))"1413 if nvm_is_iojs_version "$VERSION"; then1410 echo -n "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")"1414 echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION") $NPM_VERSION"1415 else1412 echo -n "Now using node $VERSION"1416 echo "Now using node $VERSION $NPM_VERSION"1417 fi1414 echo " (npm v$(npm --version 2>/dev/null))"1418 ;;1419 "run" )1420 local provided_version1421 local has_checked_nvmrc
344 unmodified lines