Skip to content
Myr

[Fix] ensure --reinstall-packages-from has a version number.

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

Fixes #1760.

authored by Jordan Harband · committed by Jordan Harband · parent 2850e65 · Browse files · 2 files+22 added−0 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+22 added−0 removed

  • tests:+14 added−0 removed
  • other:+8 added−0 removed

2 files+22 added−0 removed

modified:test/fast/Running "nvm install" with "--reinstall-packages-from" requires a valid version+14 added
37 unmodified lines
38set -e39[ $INSTALL_EXIT_CODE -eq 4 ] \40 || die ""nvm install --reinstall-packages-from" should exit with code 4 when given the same version, got $INSTALL_EXIT_CODE"4142set +ex # needed for stderr43INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from 2>&1)"44set -ex45EXPECTED_ERROR_MSG='If --reinstall-packages-from is provided, it must point to an installed version of node using `=`.'46[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \47 || die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"4849set +ex # needed for stderr50INSTALL_ERROR_MSG="$(nvm install v0.10.5 --reinstall-packages-from= 2>&1)"51set -ex52EXPECTED_ERROR_MSG="If --reinstall-packages-from is provided, it must point to an installed version of node."53[ "~$INSTALL_ERROR_MSG" = "~$EXPECTED_ERROR_MSG" ] \54 || die ""nvm install --reinstall-packages-from" should fail when given an uninstalled version: expected '$EXPECTED_ERROR_MSG', got '$INSTALL_ERROR_MSG'"5556cleanup
modified:nvm.sh+8 added
2556 unmodified lines
2557 do2558 case "$1" in2559 --reinstall-packages-from=*)2560 PROVIDED_REINSTALL_PACKAGES_FROM="$(nvm_echo "$1" | command cut -c 27-)"2561 if [ -z "${PROVIDED_REINSTALL_PACKAGES_FROM}" ]; then2562 nvm_err 'If --reinstall-packages-from is provided, it must point to an installed version of node.'2563 return 62564 fi2565 REINSTALL_PACKAGES_FROM="$(nvm_version "$PROVIDED_REINSTALL_PACKAGES_FROM")" ||:2566 ;;2567 --reinstall-packages-from)2568 nvm_err 'If --reinstall-packages-from is provided, it must point to an installed version of node using `=`.'2569 return 62570 ;;2571 --copy-packages-from=*)2572 PROVIDED_REINSTALL_PACKAGES_FROM="$(nvm_echo "$1" | command cut -c 22-)"2573 REINSTALL_PACKAGES_FROM="$(nvm_version "$PROVIDED_REINSTALL_PACKAGES_FROM")" ||:2574 ;;
984 unmodified lines