Skip to content
Myr

`nvm use system` should work as expected.

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

authored by Jordan Harband · committed by Jordan Harband · parent 9912f7c · Browse files · 2 files+24 added−1 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+24 added−1 removed

  • tests:+13 added−0 removed
  • other:+11 added−1 removed

2 files+24 added−1 removed

added:test/fast/Running "nvm use system" should work as expected+13 added
1#!/bin/sh23die () { echo $@ ; exit 1; }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"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"13
modified:nvm.sh+11 added-1 removed
548 unmodified lines
549 if [ -n "$NVM_RC_VERSION" ]; then550 VERSION=`nvm_version $NVM_RC_VERSION`551 fi552 else553 if [ $2 = 'system' ]; then554 if nvm_has_system_node && nvm deactivate; then555 echo "Now using system version of node: $(node -v 2>/dev/null)."556 return557 else558 echo "System version of node not found." >&2559 return 127560 fi561 else553 VERSION=`nvm_version $2`562 VERSION=`nvm_version $2`563 fi564 fi565 if [ -z "$VERSION" ]; then566 nvm help567 return 127
172 unmodified lines