[Tests] use `$NVM_DIR` instead of relative paths

Jordan Harband 2016-06-26 15:52:26 -07:00
parent ce60b6c44a
commit 73aa35f508
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
27 changed files with 137 additions and 151 deletions

View File

@ -5,18 +5,18 @@
die () { echo $@ ; cleanup ; exit 1; }
cleanup () {
rm -rf ../../../alias/stable
rm -rf ../../../alias/unstable
rm -rf ../../../alias/node
rm -rf ../../../alias/iojs
rm -rf ../../../v0.8.1
rm -rf ../../../v0.9.1
rm -rf ../../../versions/io.js/v0.2.1
rm -rf "$(nvm_alias_path)/stable"
rm -rf "$(nvm_alias_path)/unstable"
rm -rf "$(nvm_alias_path)/node"
rm -rf "$(nvm_alias_path)/iojs"
rm -rf "${NVM_DIR}/v0.8.1"
rm -rf "${NVM_DIR}/v0.9.1"
rm -rf "${NVM_DIR}/versions/io.js/v0.2.1"
}
mkdir ../../../v0.8.1
mkdir ../../../v0.9.1
mkdir -p ../../../versions/io.js/v0.2.1
mkdir "${NVM_DIR}/v0.8.1"
mkdir "${NVM_DIR}/v0.9.1"
mkdir -p "${NVM_DIR}/versions/io.js/v0.2.1"
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"

View File

@ -1,11 +1,11 @@
#!/bin/sh
mkdir -p ../../../v0.0.2
mkdir -p ../../../v0.0.20
mkdir -p ../../../versions/node/v0.12.0
. ../../../nvm.sh
mkdir -p "${NVM_DIR}/v0.0.2"
mkdir -p "${NVM_DIR}/v0.0.20"
mkdir -p "${NVM_DIR}/versions/node/v0.12.0"
die () { echo $@ ; exit 1; }
# The result should contain only the appropriate version numbers.
@ -24,4 +24,3 @@ nvm which 0.12.0 || die "v0.0.20 not found"
NVM_BIN="$(nvm which 0.12.0)"
[ "_$NVM_BIN" = "_$(nvm_version_path v0.12.0)/bin/node" ] \
|| die "'nvm which 0.12.0' did not contain the correct path: got '$NVM_BIN'"

View File

@ -1,10 +1,10 @@
#!/bin/sh
mkdir ../../../v0.0.2
mkdir ../../../v0.0.20
. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.0.2"
mkdir "${NVM_DIR}/v0.0.20"
die () { echo $@ ; exit 1; }
# The result should contain only the appropriate version numbers.

View File

@ -1,11 +1,11 @@
#!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
mkdir ../../../v0.20.3
. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.20.3"
die () { echo $@ ; exit 1; }
# The result should contain only the appropriate version numbers.

View File

@ -4,8 +4,8 @@
die () { echo $@ ; exit 1; }
mkdir ../../../v0.2.3
mkdir ../../../v0.3.3
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.3.3"
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
@ -19,7 +19,7 @@ nvm ls stable | \grep "$STABLE_VERSION" >/dev/null \
nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \
|| die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)"
mkdir ../../../v0.1.2
mkdir "${NVM_DIR}/v0.1.2"
nvm alias stable 0.1
nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \

View File

@ -4,12 +4,12 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
mkdir -p ../../../v0.0.1
mkdir -p ../../../v0.0.3
mkdir -p ../../../v0.0.9
mkdir -p ../../../v0.3.1
mkdir -p ../../../v0.3.3
mkdir -p ../../../v0.3.9
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p "${NVM_DIR}/v0.3.9"
nvm_has_system_node() { return 0; }
nvm ls system | grep system 2>&1 > /dev/null

View File

@ -2,16 +2,16 @@
. ../../../nvm.sh
mkdir ../../../v0.0.1
mkdir ../../../v0.0.3
mkdir ../../../v0.0.9
mkdir ../../../v0.3.1
mkdir ../../../v0.3.3
mkdir ../../../v0.3.9
mkdir -p ../../../versions/node/v0.12.87
mkdir -p ../../../versions/node/v0.12.9
mkdir -p ../../../versions/io.js/v0.1.2
mkdir -p ../../../versions/io.js/v0.10.2
mkdir "${NVM_DIR}/v0.0.1"
mkdir "${NVM_DIR}/v0.0.3"
mkdir "${NVM_DIR}/v0.0.9"
mkdir "${NVM_DIR}/v0.3.1"
mkdir "${NVM_DIR}/v0.3.3"
mkdir "${NVM_DIR}/v0.3.9"
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
# The result should contain the version numbers.
nvm ls | grep v0.0.1 >/dev/null &&

View File

@ -1,9 +1,9 @@
#!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
[ -z `nvm ls | grep '^ *\.'` ]
# The result should contain only the appropriate version numbers.

View File

@ -1,10 +1,10 @@
#!/bin/sh
mkdir ../../../v0.1.3
mkdir ../../../v0.2.3
mkdir -p ../../../versions/node
. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.3"
mkdir "${NVM_DIR}/v0.2.3"
mkdir -p "${NVM_DIR}/versions/node"
[ -z "$(nvm ls | \grep 'versions')" ]
# The result should contain only the appropriate version numbers.

View File

@ -4,12 +4,12 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
mkdir -p ../../../v0.0.1
mkdir -p ../../../v0.0.3
mkdir -p ../../../v0.0.9
mkdir -p ../../../v0.3.1
mkdir -p ../../../v0.3.3
mkdir -p ../../../v0.3.9
mkdir -p "${NVM_DIR}/v0.0.1"
mkdir -p "${NVM_DIR}/v0.0.3"
mkdir -p "${NVM_DIR}/v0.0.9"
mkdir -p "${NVM_DIR}/v0.3.1"
mkdir -p "${NVM_DIR}/v0.3.3"
mkdir -p "${NVM_DIR}/v0.3.9"
nvm_has_system_node() { return 0; }
nvm ls | grep system 2>&1 > /dev/null

View File

@ -2,10 +2,10 @@
die () { echo $@ ; exit 1; }
mkdir -p ../../../versions/node/v0.12.1
mkdir ../../../v0.1.3
. ../../../nvm.sh
mkdir -p "${NVM_DIR}/versions/node/v0.12.1"
mkdir "${NVM_DIR}/v0.1.3"
nvm ls 0.12 | grep v0.12.1 || die '"nvm ls" did not list a version in the versions/ directory'
nvm ls 0.1 | grep v0.1.3 || die '"nvm ls" did not list a version not in the versions/ directory'

View File

@ -1,9 +1,9 @@
#!/bin/sh
mkdir ../../../v0.1.2
. ../../../nvm.sh
mkdir "${NVM_DIR}/v0.1.2"
nvm ls v0.1 | grep v0.1.2 &&
nvm ls v0.1.2 | grep v0.1.2 &&
nvm ls v0.1. | grep v0.1.2 &&

View File

@ -2,13 +2,13 @@
die () { echo $@ ; cleanup ; exit 1; }
cleanup () {
rm -rf ../../v0.10.4
rm -rf "${NVM_DIR}/v0.10.4"
}
mkdir ../../v0.10.4
. ../../nvm.sh
mkdir "${NVM_DIR}/v0.10.4"
nvm deactivate >/dev/null 2>&1
INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from=0.11 2>&1)"
@ -29,3 +29,4 @@ INSTALL_EXIT_CODE="$(nvm install v0.10.5 --reinstall-packages-from=0.10.5 >/dev/
[ "~$INSTALL_EXIT_CODE" = "~4" ] \
|| die ""nvm install --reinstall-packages-from" should exit with code 4 when given the same version, got $INSTALL_EXIT_CODE"
cleanup

View File

@ -3,31 +3,31 @@
export NVM_SYMLINK_CURRENT=true
. ../../nvm.sh
rm -rf ../../v0.10.29
mkdir ../../v0.10.29
rm -rf "${NVM_DIR}/v0.10.29"
mkdir "${NVM_DIR}/v0.10.29"
nvm use 0.10.29
rmdir ../../v0.10.29
rmdir "${NVM_DIR}/v0.10.29"
if [ ! -L ../../current ];then
if [ ! -L "${NVM_DIR}/current" ];then
echo "Expected 'current' symlink to be created!"
exit 1
fi
oldLink="$(readlink ../../current)"
oldLink="$(readlink "${NVM_DIR}/current")"
if [ "$(basename $oldLink)" != 'v0.10.29' ];then
echo "Expected 'current' to point to v0.10.29 but was $oldLink"
if [ "$(basename "${oldLink}")" != 'v0.10.29' ];then
echo "Expected 'current' to point to v0.10.29 but was ${oldLink}"
exit 1
fi
rm -rf ../../v0.11.13
mkdir ../../v0.11.13
rm -rf "${NVM_DIR}/v0.11.13"
mkdir "${NVM_DIR}/v0.11.13"
nvm use 0.11.13
rmdir ../../v0.11.13
rmdir "${NVM_DIR}/v0.11.13"
newLink="$(readlink ../../current)"
newLink="$(readlink "${NVM_DIR}/current")"
if [ "$(basename $newLink)" != 'v0.11.13' ];then
if [ "$(basename "${newLink}")" != 'v0.11.13' ];then
echo "Expected 'current' to point to v0.11.13 but was $newLink"
exit 1
fi

View File

@ -1,17 +1,17 @@
#!/bin/sh
cleanup () {
rm ../../../versions/io.js/v0.1.2/node
rm ../../../versions/io.js/v0.1.2/iojs
rmdir ../../../versions/io.js/v0.1.2
rm "${NVM_DIR}/versions/io.js/v0.1.2/node"
rm "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
rmdir "${NVM_DIR}/versions/io.js/v0.1.2"
}
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
mkdir ../../../versions/io.js/v0.1.2
touch ../../../versions/io.js/v0.1.2/node
touch ../../../versions/io.js/v0.1.2/iojs
mkdir "${NVM_DIR}/versions/io.js/v0.1.2"
touch "${NVM_DIR}/versions/io.js/v0.1.2/node"
touch "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
nvm use iojs-v0.1.2
@ -28,4 +28,3 @@ if command -v iojs; then
else
! nvm_has_system_iojs
fi

View File

@ -1,15 +1,14 @@
#!/bin/sh
cleanup () {
rm ../../../v0.1.2/node
rmdir ../../../v0.1.2
}
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
mkdir ../../../v0.1.2
touch ../../../v0.1.2/node
cleanup () {
rm -rf "${NVM_DIR}/v0.1.2/node"
}
die () { echo $@ ; exit 1; }
mkdir "${NVM_DIR}/v0.1.2"
touch "${NVM_DIR}/v0.1.2/node"
nvm use 0.1.2
@ -26,4 +25,3 @@ if command -v node; then
else
! nvm_has_system_node
fi

View File

@ -2,25 +2,25 @@
die () { echo $@ ; cleanup ; exit 1; }
cleanup() {
rm -rf ../../../v0.2.3
rm -rf ../../../v0.3.4
rm -rf ../../../v0.4.6
rm -rf ../../../v0.5.7
rm -rf ../../../v0.7.7
rm -rf ../../../versions/io.js/v0.98.0
rm -rf ../../../versions/node/v1.0.0
rm -rf ../../../versions/node/v1.1.0
rm -rf "${NVM_DIR}/v0.2.3"
rm -rf "${NVM_DIR}/v0.3.4"
rm -rf "${NVM_DIR}/v0.4.6"
rm -rf "${NVM_DIR}/v0.5.7"
rm -rf "${NVM_DIR}/v0.7.7"
rm -rf "${NVM_DIR}/versions/io.js/v0.98.0"
rm -rf "${NVM_DIR}/versions/node/v1.0.0"
rm -rf "${NVM_DIR}/versions/node/v1.1.0"
unset -f nvm_ls_remote nvm_ls_remote_iojs
}
. ../../../nvm.sh
mkdir ../../../v0.2.3
mkdir ../../../v0.3.4
mkdir ../../../v0.4.6
mkdir ../../../v0.5.7
mkdir ../../../v0.7.7
mkdir -p ../../../versions/io.js/v0.98.0
mkdir "${NVM_DIR}/v0.2.3"
mkdir "${NVM_DIR}/v0.3.4"
mkdir "${NVM_DIR}/v0.4.6"
mkdir "${NVM_DIR}/v0.5.7"
mkdir "${NVM_DIR}/v0.7.7"
mkdir -p "${NVM_DIR}/versions/io.js/v0.98.0"
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_0.4" ] || die "local stable is not latest even minor: expected 0.4, got $LATEST_STABLE"
@ -35,8 +35,8 @@ LATEST_IOJS="$(nvm_print_implicit_alias local iojs)"
[ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS"
## node post v1.0/io.js merger ##
mkdir -p ../../../versions/node/v1.0.0
mkdir -p ../../../versions/node/v1.1.0
mkdir -p "${NVM_DIR}/versions/node/v1.0.0"
mkdir -p "${NVM_DIR}/versions/node/v1.1.0"
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
[ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"
@ -102,4 +102,3 @@ LATEST_UNSTABLE="$(nvm_print_implicit_alias remote unstable)"
## ** ##
cleanup

View File

@ -7,8 +7,8 @@ die () { echo $@ ; exit 1; }
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering.
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1
[ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary
nvm install iojs-v1.0.0
@ -23,4 +23,3 @@ nvm install iojs-v1.0.1
node --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (node binary)"
iojs --version | grep v1.0.1 || die "nvm install on already installed version doesn't use it (iojs binary)"

View File

@ -8,12 +8,11 @@ NVM_TEST_VERSION="v1.0.0"
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
# Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
[ -e "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ] && rm -R "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
# Install from binary
nvm install $NVM_PREFIXED_TEST_VERSION || die "install $NVM_PREFIXED_TEST_VERSION failed"
# Check
[ -d ../../../versions/io.js/$NVM_TEST_VERSION ]
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
[ -d "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ]
nvm run "${NVM_PREFIXED_TEST_VERSION}" --version | grep "${NVM_TEST_VERSION}" || die "'nvm run ${NVM_PREFIXED_TEST_VERSION} --version | grep ${NVM_TEST_VERSION}' failed"

View File

@ -5,16 +5,16 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0
[ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1
[ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary
nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed"
nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed"
# Check
[ -d ../../versions/io.js/v1.0.0 ] || die "iojs v1.0.0 didn't exist"
[ -d ../../versions/io.js/v1.0.1 ] || die "iojs v1.0.1 didn't exist"
[ -d "${NVM_DIR}/versions/io.js/v1.0.0" ] || die "iojs v1.0.0 didn't exist"
[ -d "${NVM_DIR}/versions/io.js/v1.0.1" ] || die "iojs v1.0.1 didn't exist"
# Use the first one
nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"
@ -23,4 +23,3 @@ nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"
nvm use iojs-1 || die "'nvm use iojs-1' failed"
[ "_$(node --version)" = "_v1.0.1" ] || die "'node --version' was not v1.0.1, got: $(node --version)"
[ "_$(iojs --version)" = "_v1.0.1" ] || die "'iojs --version' was not v1.0.1, got: $(iojs --version)"

View File

@ -5,20 +5,18 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh
NVM_TEST_VERSION=v1.0.0
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
VERSION_PATH="../../versions/io.js/$NVM_TEST_VERSION"
NVM_PREFIXED_TEST_VERSION="iojs-${NVM_TEST_VERSION}"
VERSION_PATH="${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
# Remove the stuff we're clobbering.
[ -e $VERSION_PATH ] && rm -R $VERSION_PATH
[ -e "${VERSION_PATH}" ] && rm -R "${VERSION_PATH}"
# Install from binary
echo "$NVM_PREFIXED_TEST_VERSION" > .nvmrc
echo "${NVM_PREFIXED_TEST_VERSION}" > .nvmrc
nvm install || die "'nvm install' failed"
# Check
[ -d $VERSION_PATH ] || die "./$VERSION_PATH did not exist"
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|| "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
[ -d "${VERSION_PATH}" ] || die "./${VERSION_PATH} did not exist"
nvm run "${NVM_PREFIXED_TEST_VERSION}" --version | grep "${NVM_TEST_VERSION}" \
|| "'nvm run \'${NVM_PREFIXED_TEST_VERSION}\' --version | grep \'${NVM_TEST_VERSION}\'' failed"

View File

@ -5,14 +5,14 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0
[ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1
[ -e "${NVM_DIR}/versions/io.js/v1.0.0" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.0"
[ -e "${NVM_DIR}/versions/io.js/v1.0.1" ] && rm -R "${NVM_DIR}/versions/io.js/v1.0.1"
# Install from binary
nvm install iojs-v1.0.0
# Check
[ -d ../../versions/io.js/v1.0.0 ] || die "nvm install iojs-v1.0.0 didn't install"
[ -d "${NVM_DIR}/versions/io.js/v1.0.0" ] || die "nvm install iojs-v1.0.0 didn't install"
node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0"
@ -23,10 +23,9 @@ nvm ls iojs-1 | grep iojs-v1.0.0 > /dev/null || die "nvm ls iojs-1 didn't show i
nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed"
[ -d ../../versions/io.js/v1.0.1 ] || die "nvm install iojs-v1.0.1 didn't install"
[ -d "${NVM_DIR}/versions/io.js/v1.0.1" ] || die "nvm install iojs-v1.0.1 didn't install"
nvm use iojs-1
node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"

View File

@ -15,6 +15,5 @@ NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed"
# Check
[ -d ../../versions/io.js/$NVM_TEST_VERSION ]
[ -d "${NVM_DIR}/versions/io.js/$NVM_TEST_VERSION" ]
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@ -7,8 +7,8 @@ die () { echo $@ ; exit 1; }
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
[ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary
nvm install 0.9.7
@ -21,4 +21,3 @@ node --version | grep v0.9.7 || die "precondition failed: node doesn't start at
nvm install 0.9.12
node --version | grep v0.9.12 || die "nvm install on already installed version doesn't use it"

View File

@ -5,16 +5,16 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
[ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary
nvm install 0.9.7 || die "'nvm install 0.9.7' failed"
nvm i 0.9.12 || die "'nvm i 0.9.12' failed"
# Check
[ -d ../../v0.9.7 ] || die "v0.9.7 didn't exist"
[ -d ../../v0.9.12 ] || die "v0.9.12 didn't exist"
[ -d "${NVM_DIR}/v0.9.7" ] || die "v0.9.7 didn't exist"
[ -d "${NVM_DIR}/v0.9.12" ] || die "v0.9.12 didn't exist"
# Use the first one
nvm use 0.9.7 || die "'nvm use 0.9.7' failed"
@ -22,4 +22,3 @@ nvm use 0.9.7 || die "'nvm use 0.9.7' failed"
# Use the latest one
nvm use 0.9 || die "'nvm use 0.9' failed"
node --version | grep v0.9.12 || die "'node --version' was not v0.9.12, got: $(node --version)"

View File

@ -5,14 +5,14 @@ die () { echo $@ ; exit 1; }
. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
[ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
[ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
# Install from binary
nvm install 0.9.7
# Check
[ -d ../../v0.9.7 ] || die "nvm install 0.9.7 didn't install"
[ -d "${NVM_DIR}/v0.9.7" ] || die "nvm install 0.9.7 didn't install"
nvm use 0.9.7
@ -25,10 +25,9 @@ nvm ls 0.9 | grep v0.9.7 > /dev/null || die "nvm ls 0.9 didn't show v0.9.7"
nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed"
[ -d ../../v0.9.12 ] || die "nvm install 0.9.12 didn't install"
[ -d "${NVM_DIR}/v0.9.12" ] || die "nvm install 0.9.12 didn't install"
nvm use 0.9
node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"

View File

@ -2,9 +2,9 @@
. ../../../nvm.sh
mkdir -p ../../../.nvm_use_bak
if [ -d "../../../v*" ]; then
mv "../../../v*" ../../../.nvm_use_bak/
mkdir -p "${NVM_DIR}/.nvm_use_bak"
if [ -d "${NVM_DIR}/v*" ]; then
mv "${NVM_DIR}/v*" "${NVM_DIR}/.nvm_use_bak/"
fi
for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do