Merge pull request #523 from creationix/run_slow_nvmrc_tests_too

Actually run all tests; fix some bugs
master
Jordan Harband 2014-09-14 16:38:12 -07:00
commit 7bb6e9c915
6 changed files with 19 additions and 12 deletions

11
nvm.sh
View File

@ -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

View File

View File

@ -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}
}

View File

@ -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'"

View File

@ -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

View File

@ -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