From 73aa35f508a386e7a9e0268594e47e0eb59516db Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 26 Jun 2016 15:52:26 -0700 Subject: [PATCH] [Tests] use `$NVM_DIR` instead of relative paths --- ... instead of implicit aliases when present" | 20 +++++------ ....0.2\" should display only version 0.0.2." | 9 +++-- ....0.2\" should display only version 0.0.2." | 6 ++-- ...0.2\" should display only 0.2.x versions." | 8 ++--- ...uld return the appropriate implicit alias" | 6 ++-- ...hould include \"system\" when appropriate" | 12 +++---- ...\" should display all installed versions." | 20 +++++------ ...ing \"nvm ls\" should filter out \".nvm\"" | 6 ++-- ...\"nvm ls\" should filter out \"versions\"" | 8 ++--- ...hould include \"system\" when appropriate" | 12 +++---- ...st versions in the \"versions\" directory" | 6 ++-- ...vx.x.x should only list a matched version" | 4 +-- ...-packages-from\" requires a valid version" | 7 ++-- ...create and change the \"current\" symlink" | 24 +++++++------- test/fast/Unit tests/nvm_has_system_iojs | 13 ++++---- test/fast/Unit tests/nvm_has_system_node | 16 ++++----- .../nvm_print_implicit_alias success | 33 +++++++++---------- .../install already installed uses it | 5 ++- test/installation_iojs/install from binary | 7 ++-- ...nstall two versions and use the latest one | 9 +++-- ...ll version specified in .nvmrc from binary | 16 ++++----- .../install while reinstalling packages | 9 +++-- test/installation_iojs/nvm install v1 works | 3 +- .../install already installed uses it | 5 ++- ...nstall two versions and use the latest one | 9 +++-- .../install while reinstalling packages | 9 +++-- test/slow/nvm use/setup_dir | 6 ++-- 27 files changed, 137 insertions(+), 151 deletions(-) diff --git "a/test/fast/Aliases/Running \"nvm alias\" lists manual aliases instead of implicit aliases when present" "b/test/fast/Aliases/Running \"nvm alias\" lists manual aliases instead of implicit aliases when present" index 45346bd..050baf6 100755 --- "a/test/fast/Aliases/Running \"nvm alias\" lists manual aliases instead of implicit aliases when present" +++ "b/test/fast/Aliases/Running \"nvm alias\" lists manual aliases instead of implicit aliases when present" @@ -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")" diff --git "a/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2." "b/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2." index 333782e..3ead43e 100755 --- "a/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2." +++ "b/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2." @@ -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'" - diff --git "a/test/fast/Listing versions/Running \"nvm ls 0.0.2\" should display only version 0.0.2." "b/test/fast/Listing versions/Running \"nvm ls 0.0.2\" should display only version 0.0.2." index 45a2d1a..92c59bc 100755 --- "a/test/fast/Listing versions/Running \"nvm ls 0.0.2\" should display only version 0.0.2." +++ "b/test/fast/Listing versions/Running \"nvm ls 0.0.2\" should display only version 0.0.2." @@ -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. diff --git "a/test/fast/Listing versions/Running \"nvm ls 0.2\" should display only 0.2.x versions." "b/test/fast/Listing versions/Running \"nvm ls 0.2\" should display only 0.2.x versions." index 8889f09..8a6630d 100755 --- "a/test/fast/Listing versions/Running \"nvm ls 0.2\" should display only 0.2.x versions." +++ "b/test/fast/Listing versions/Running \"nvm ls 0.2\" should display only 0.2.x versions." @@ -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. diff --git "a/test/fast/Listing versions/Running \"nvm ls stable\" and \"nvm ls unstable\" should return the appropriate implicit alias" "b/test/fast/Listing versions/Running \"nvm ls stable\" and \"nvm ls unstable\" should return the appropriate implicit alias" index 79051bd..195f197 100755 --- "a/test/fast/Listing versions/Running \"nvm ls stable\" and \"nvm ls unstable\" should return the appropriate implicit alias" +++ "b/test/fast/Listing versions/Running \"nvm ls stable\" and \"nvm ls unstable\" should return the appropriate implicit alias" @@ -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 \ diff --git "a/test/fast/Listing versions/Running \"nvm ls system\" should include \"system\" when appropriate" "b/test/fast/Listing versions/Running \"nvm ls system\" should include \"system\" when appropriate" index d24cb3c..16b4308 100755 --- "a/test/fast/Listing versions/Running \"nvm ls system\" should include \"system\" when appropriate" +++ "b/test/fast/Listing versions/Running \"nvm ls system\" should include \"system\" when appropriate" @@ -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 diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should display all installed versions." "b/test/fast/Listing versions/Running \"nvm ls\" should display all installed versions." index e7cc3f7..d8ee316 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" should display all installed versions." +++ "b/test/fast/Listing versions/Running \"nvm ls\" should display all installed versions." @@ -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 && diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \".nvm\"" "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \".nvm\"" index d01aa7a..a1d1f5b 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \".nvm\"" +++ "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \".nvm\"" @@ -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. diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" index d63066d..1e8183e 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" +++ "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" @@ -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. diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should include \"system\" when appropriate" "b/test/fast/Listing versions/Running \"nvm ls\" should include \"system\" when appropriate" index e8554f0..a5a5514 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" should include \"system\" when appropriate" +++ "b/test/fast/Listing versions/Running \"nvm ls\" should include \"system\" when appropriate" @@ -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 diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should list versions in the \"versions\" directory" "b/test/fast/Listing versions/Running \"nvm ls\" should list versions in the \"versions\" directory" index 488e991..62492d2 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" should list versions in the \"versions\" directory" +++ "b/test/fast/Listing versions/Running \"nvm ls\" should list versions in the \"versions\" directory" @@ -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' diff --git "a/test/fast/Listing versions/Running \"nvm ls\" with node-like versioning vx.x.x should only list a matched version" "b/test/fast/Listing versions/Running \"nvm ls\" with node-like versioning vx.x.x should only list a matched version" index eeebea5..24b3db4 100755 --- "a/test/fast/Listing versions/Running \"nvm ls\" with node-like versioning vx.x.x should only list a matched version" +++ "b/test/fast/Listing versions/Running \"nvm ls\" with node-like versioning vx.x.x should only list a matched version" @@ -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 && diff --git "a/test/fast/Running \"nvm install\" with \"--reinstall-packages-from\" requires a valid version" "b/test/fast/Running \"nvm install\" with \"--reinstall-packages-from\" requires a valid version" index 00b6bc6..c6d2c33 100755 --- "a/test/fast/Running \"nvm install\" with \"--reinstall-packages-from\" requires a valid version" +++ "b/test/fast/Running \"nvm install\" with \"--reinstall-packages-from\" requires a valid version" @@ -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 diff --git "a/test/fast/Running \"nvm use x\" should create and change the \"current\" symlink" "b/test/fast/Running \"nvm use x\" should create and change the \"current\" symlink" index fcc4acb..8ddaedc 100755 --- "a/test/fast/Running \"nvm use x\" should create and change the \"current\" symlink" +++ "b/test/fast/Running \"nvm use x\" should create and change the \"current\" symlink" @@ -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 diff --git a/test/fast/Unit tests/nvm_has_system_iojs b/test/fast/Unit tests/nvm_has_system_iojs index bb58da6..58e858f 100755 --- a/test/fast/Unit tests/nvm_has_system_iojs +++ b/test/fast/Unit tests/nvm_has_system_iojs @@ -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 - diff --git a/test/fast/Unit tests/nvm_has_system_node b/test/fast/Unit tests/nvm_has_system_node index 6265d00..10629ee 100755 --- a/test/fast/Unit tests/nvm_has_system_node +++ b/test/fast/Unit tests/nvm_has_system_node @@ -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 - diff --git a/test/fast/Unit tests/nvm_print_implicit_alias success b/test/fast/Unit tests/nvm_print_implicit_alias success index 425350f..7a53d0c 100755 --- a/test/fast/Unit tests/nvm_print_implicit_alias success +++ b/test/fast/Unit tests/nvm_print_implicit_alias success @@ -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 - diff --git a/test/installation_iojs/install already installed uses it b/test/installation_iojs/install already installed uses it index 7065e78..665dbbe 100755 --- a/test/installation_iojs/install already installed uses it +++ b/test/installation_iojs/install already installed uses it @@ -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)" - diff --git a/test/installation_iojs/install from binary b/test/installation_iojs/install from binary index 93c65cd..8be865e 100755 --- a/test/installation_iojs/install from binary +++ b/test/installation_iojs/install from binary @@ -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" diff --git a/test/installation_iojs/install two versions and use the latest one b/test/installation_iojs/install two versions and use the latest one index 69c5869..cc85653 100755 --- a/test/installation_iojs/install two versions and use the latest one +++ b/test/installation_iojs/install two versions and use the latest one @@ -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)" - diff --git a/test/installation_iojs/install version specified in .nvmrc from binary b/test/installation_iojs/install version specified in .nvmrc from binary index 82dc5f6..b798c2d 100755 --- a/test/installation_iojs/install version specified in .nvmrc from binary +++ b/test/installation_iojs/install version specified in .nvmrc from binary @@ -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" diff --git a/test/installation_iojs/install while reinstalling packages b/test/installation_iojs/install while reinstalling packages index 6b17997..56e5ff4 100755 --- a/test/installation_iojs/install while reinstalling packages +++ b/test/installation_iojs/install while reinstalling packages @@ -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" - diff --git a/test/installation_iojs/nvm install v1 works b/test/installation_iojs/nvm install v1 works index 2bc83f0..67d6156 100755 --- a/test/installation_iojs/nvm install v1 works +++ b/test/installation_iojs/nvm install v1 works @@ -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" - diff --git a/test/installation_node/install already installed uses it b/test/installation_node/install already installed uses it index 8a7dd9a..b47694f 100755 --- a/test/installation_node/install already installed uses it +++ b/test/installation_node/install already installed uses it @@ -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" - diff --git a/test/installation_node/install two versions and use the latest one b/test/installation_node/install two versions and use the latest one index 77dc9e4..6f1d380 100755 --- a/test/installation_node/install two versions and use the latest one +++ b/test/installation_node/install two versions and use the latest one @@ -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)" - diff --git a/test/installation_node/install while reinstalling packages b/test/installation_node/install while reinstalling packages index 3eb0a2c..7d1a15e 100755 --- a/test/installation_node/install while reinstalling packages +++ b/test/installation_node/install while reinstalling packages @@ -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" - diff --git a/test/slow/nvm use/setup_dir b/test/slow/nvm use/setup_dir index a3ab0f7..20fa239 100755 --- a/test/slow/nvm use/setup_dir +++ b/test/slow/nvm use/setup_dir @@ -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