Browse Source

Merge pull request #523 from creationix/run_slow_nvmrc_tests_too

Actually run all tests; fix some bugs
run_installation_tests_separately
Jordan Harband 10 years ago
parent
commit
7bb6e9c915
  1. 11
      nvm.sh
  2. 0
      test/fast/Listing versions/teardown
  3. 2
      test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false
  4. 14
      test/slow/nvm copy-packages/Running "nvm copy-packages $(nvm ls current)" should error out
  5. 2
      test/slow/nvm install/install version specified in .nvmrc from binary
  6. 2
      test/slow/nvm install/install version specified in .nvmrc from source

11
nvm.sh

@ -433,19 +433,20 @@ nvm() {
fi
provided_version=$1
if [ -z "$provided_version" ]; then
if [ $version_not_provided -ne 1 ]; then
nvm_rc_version
fi
provided_version="$NVM_RC_VERSION"
else
shift
fi
[ -d "$(nvm_version_path "$provided_version")" ] && echo "$provided_version is already installed." >&2 && return
VERSION=`nvm_remote_version $provided_version`
ADDITIONAL_PARAMETERS=''
shift
while [ $# -ne 0 ]
do
ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1"
@ -494,7 +495,9 @@ nvm() {
fi
fi
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
if [ -n "$ADDITIONAL_PARAMETERS" ]; then
echo "Additional options while compiling: $ADDITIONAL_PARAMETERS"
fi
tarball=''
sum=''
@ -796,7 +799,7 @@ nvm() {
local PROVIDED_VERSION
PROVIDED_VERSION="$2"
if [ "$PROVIDED_VERSION" = "$(nvm_ls_current)" ]; then
if [ "$PROVIDED_VERSION" = "$(nvm_ls_current)" ] || [ "$(nvm_version $PROVIDED_VERSION)" = "$(nvm_ls_current)" ]; then
echo 'Can not copy packages from the current version of node.' >&2
return 2
fi

0
test/fast/Listing versions/teardown

2
test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false

@ -34,7 +34,7 @@ function cleanup() {
function runNvmUse() {
mkdir ../../${TEST_NODE_VERSION}
nvm use ${TEST_NODE_VERSION} &> /dev/null
nvm use ${TEST_NODE_VERSION} > /dev/null 2>&1
rmdir ../../${TEST_NODE_VERSION}
}

14
test/slow/nvm copy-packages/Running "nvm copy-packages $(nvm ls current)" should error out

@ -2,11 +2,15 @@
die () { echo $@ ; exit 1; }
. ../../nvm.sh
. ../../../nvm.sh
local EXPECTED_MSG="Can not copy packages from the current version of node."
[ "$(nvm use 0.10.28 && nvm copy-packages 0.10.28 2&>1)" = "$EXPECTED_MSG" ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right message'
nvm use 0.10.28 > /dev/null
$(nvm use 0.10.28 && nvm copy-packages 0.10.28)
[ $? = 2 ] || die '"nvm use 0.10.28 && nvm copy-packages 0.10.28" did not fail with the right error code'
EXPECTED_MSG="Can not copy packages from the current version of node."
ACTUAL_MSG="$(nvm copy-packages 0.10.28 2>&1 > /dev/null)"
[ "~$ACTUAL_MSG" = "~$EXPECTED_MSG" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right message: '$ACTUAL_MESSAGE'"
EXPECTED_ERROR_CODE="2"
ACTUAL_ERROR_CODE="$(nvm copy-packages 0.10.28 > /dev/null 2>&1 ; echo $?)"
[ "~$ACTUAL_ERROR_CODE" = "~$EXPECTED_ERROR_CODE" ] || die "'nvm use 0.10.28 && nvm copy-packages 0.10.28' did not fail with the right error code: expected '$EXPECTED_ERROR_CODE', got '$ACTUAL_ERROR_CODE'"

2
test/slow/nvm install/install version specified in .nvmrc from binary

@ -9,7 +9,7 @@ NVM_TEST_VERSION=v0.10.7
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from binary
cat "$NVM_TEST_VERSION" > .nvmrc
echo "$NVM_TEST_VERSION" > .nvmrc
nvm install

2
test/slow/nvm install/install version specified in .nvmrc from source

@ -9,7 +9,7 @@ NVM_TEST_VERSION=v0.10.7
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
# Install from binary
cat "$NVM_TEST_VERSION" > .nvmrc
echo "$NVM_TEST_VERSION" > .nvmrc
nvm install -s

Loading…
Cancel
Save