Files
nvm/test/installation_node/install while reinstalling packages
Jordan Harband e2e612e722
Some checks are pending
Code scanning - action / CodeQL-Build (push) Waiting to run
Tests: `nvm install-latest-npm` / matrix (push) Waiting to run
Tests: `nvm install-latest-npm` / nvm install-latest-npm (push) Blocked by required conditions
Tests: linting / eclint (push) Waiting to run
Tests: linting / dockerfile_lint (push) Waiting to run
Tests: linting / doctoc (push) Waiting to run
Tests: linting / test_naming (push) Waiting to run
Tests: linting / all linting (push) Blocked by required conditions
Tests: nvm install with set -e / matrix (push) Waiting to run
Tests: nvm install with set -e / test (push) Blocked by required conditions
Tests: nvm install with set -e / finisher (push) Blocked by required conditions
Tests: release process / release (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (bash_completion, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (install.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm-exec, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, dash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, ksh) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, sh) (push) Waiting to run
Tests: shellcheck / shellcheck (push) Blocked by required conditions
Tests: fast / fast (bash, gawk) (push) Waiting to run
Tests: fast / fast (dash, gawk) (push) Waiting to run
Tests: fast / fast (sh, gawk) (push) Waiting to run
Tests: fast / fast (zsh, gawk) (push) Waiting to run
Tests: fast / fast (bash, mawk) (push) Waiting to run
Tests: fast / fast (dash, mawk) (push) Waiting to run
Tests: fast / fast (sh, mawk) (push) Waiting to run
Tests: fast / fast (zsh, mawk) (push) Waiting to run
Tests: fast / all fast tests (push) Blocked by required conditions
Tests: installation_iojs / installation_iojs without curl (bash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (dash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (sh) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (zsh) (push) Waiting to run
Tests: installation_iojs / all installation_iojs tests (push) Blocked by required conditions
Tests: installation_node / installation_node (dash) (push) Waiting to run
Tests: installation_node / installation_node (dash, without curl) (push) Waiting to run
Tests: installation_node / installation_node (sh) (push) Waiting to run
Tests: installation_node / installation_node (sh, without curl) (push) Waiting to run
Tests: installation_node / installation_node (zsh) (push) Waiting to run
Tests: installation_node / installation_node (zsh, without curl) (push) Waiting to run
Tests: installation_node / all installation_node tests (push) Blocked by required conditions
Tests: installation_node / installation_node (bash) (push) Waiting to run
Tests: installation_node / installation_node (bash, without curl) (push) Waiting to run
Tests: xenial / xenial (bash) (push) Waiting to run
Tests: xenial / xenial (dash) (push) Waiting to run
Tests: xenial / xenial (sh) (push) Waiting to run
Tests: xenial / xenial (zsh) (push) Waiting to run
Tests: xenial / all xenial tests (push) Blocked by required conditions
urchin tests / tests (bash, install_script) (push) Waiting to run
urchin tests / all test suites, all shells (push) Blocked by required conditions
urchin tests / tests (bash, installation_iojs) (push) Waiting to run
urchin tests / tests (bash, slow) (push) Waiting to run
urchin tests / tests (bash, sourcing) (push) Waiting to run
urchin tests / tests (dash, installation_iojs) (push) Waiting to run
urchin tests / tests (dash, slow) (push) Waiting to run
urchin tests / tests (dash, sourcing) (push) Waiting to run
urchin tests / tests (sh, installation_iojs) (push) Waiting to run
urchin tests / tests (sh, slow) (push) Waiting to run
urchin tests / tests (sh, sourcing) (push) Waiting to run
urchin tests / tests (zsh, installation_iojs) (push) Waiting to run
urchin tests / tests (zsh, slow) (push) Waiting to run
urchin tests / tests (zsh, sourcing) (push) Waiting to run
update readme TOC / update readme TOC (push) Waiting to run
Tests on Windows: `nvm install` / MSYS fail prefix nvm install (push) Waiting to run
Tests on Windows: `nvm install` / tests, on windows (push) Blocked by required conditions
Tests on Windows: `nvm install` / MSYS nvm install (--default 12) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--lts) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--no-progress 10) (push) Waiting to run
Tests on Windows: `nvm install` / Cygwin nvm install (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Alpine) (push) Waiting to run
[Tests] installation_node: only match top-level global packages
2026-07-02 15:49:01 -05:00

119 lines
4.7 KiB
Bash
Executable File

#!/bin/sh
# State touched by the regression section below; cleanup restores it even on failure.
DEFAULT_PACKAGES_FILE="${NVM_DIR}/default-packages"
DEFAULT_PACKAGES_BACKUP=""
DEFAULT_PACKAGES_WROTE=""
TEST_ALIAS=""
cleanup () {
if [ -n "${DEFAULT_PACKAGES_WROTE}" ]; then
rm -f "${DEFAULT_PACKAGES_FILE}"
DEFAULT_PACKAGES_WROTE=""
fi
if [ -n "${DEFAULT_PACKAGES_BACKUP}" ] && [ -f "${DEFAULT_PACKAGES_BACKUP}" ]; then
mv "${DEFAULT_PACKAGES_BACKUP}" "${DEFAULT_PACKAGES_FILE}"
DEFAULT_PACKAGES_BACKUP=""
fi
if [ -n "${TEST_ALIAS}" ]; then
nvm unalias "${TEST_ALIAS}" > /dev/null 2>&1 || true
TEST_ALIAS=""
fi
}
die () { echo "$@" ; cleanup ; exit 1; }
\. ../../nvm.sh
# Remove the stuff we're clobbering.
[ -e "${NVM_DIR}/versions/node/v9.7.0" ] && rm -R "${NVM_DIR}/versions/node/v9.7.0"
[ -e "${NVM_DIR}/versions/node/v9.10.0" ] && rm -R "${NVM_DIR}/versions/node/v9.10.0"
[ -e "${NVM_DIR}/versions/node/v4.9.1" ] && rm -R "${NVM_DIR}/versions/node/v4.9.1"
# Install from binary
nvm install 9.7.0
# Check
[ -d "${NVM_DIR}/versions/node/v9.7.0" ] || die "nvm install 9.7.0 didn't install"
nvm use 9.7.0
node --version | grep v9.7.0 > /dev/null || die "nvm use 9.7.0 failed"
npm install -g object-is@0.0.0 || die "npm install -g object-is failed"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
nvm ls 9 | grep v9.7.0 > /dev/null || die "nvm ls 9 didn't show v9.7.0"
nvm install 9.10.0 --reinstall-packages-from=9 || die "nvm install 9.10.0 --reinstall-packages-from=9 failed"
[ -d "${NVM_DIR}/versions/node/v9.10.0" ] || die "nvm install 9.10.0 didn't install"
nvm use 9
node --version | grep v9.10.0 > /dev/null || die "nvm ls 9 didn't use v9.10.0"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
# LTS
nvm install --lts=argon --reinstall-packages-from=9 || die "nvm install 9.10.0 --reinstall-packages-from=9 failed"
[ -d "${NVM_DIR}/versions/node/v4.9.1" ] || die "nvm install 4.9.1 didn't install"
nvm use --lts=argon
node --version | grep v4.9.1 > /dev/null || die "nvm ls --lts=argon didn't use v4.9.1"
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
# Regression: `--reinstall-packages-from` must still migrate packages when the
# target version is *already installed*. See https://github.com/nvm-sh/nvm/issues/3858
# install a fresh global package on the source (v9.7.0) only
nvm use 9.7.0
npm install -g is-nan@1.0.1 || die "npm install -g is-nan failed"
npm list --global --depth=0 | grep is-nan > /dev/null || die "is-nan isn't installed on v9.7.0"
# precondition: the already-installed target (v9.10.0) must not have it yet
nvm use 9.10.0
npm list --global --depth=0 | grep is-nan > /dev/null && die "is-nan should not be installed on v9.10.0 before reinstall"
# target is already installed, so this should report so AND still migrate packages
OUTPUT="$(nvm install --reinstall-packages-from=9.7.0 9.10.0 2>&1)" || die "nvm install --reinstall-packages-from=9.7.0 9.10.0 failed: ${OUTPUT}"
nvm_echo "${OUTPUT}" | grep "is already installed" > /dev/null || die "expected 'already installed' message, got: ${OUTPUT}"
nvm use 9.10.0
npm list --global --depth=0 | grep is-nan > /dev/null || die "is-nan was not migrated to already-installed v9.10.0"
# ...the same is true for default packages: they must install on the already-installed path too.
# back up any real default-packages file, then point it at a package the target lacks
if [ -f "${DEFAULT_PACKAGES_FILE}" ]; then
DEFAULT_PACKAGES_BACKUP="${DEFAULT_PACKAGES_FILE}.3858.bak"
mv "${DEFAULT_PACKAGES_FILE}" "${DEFAULT_PACKAGES_BACKUP}" || die "could not back up ${DEFAULT_PACKAGES_FILE}"
fi
DEFAULT_PACKAGES_WROTE=1
nvm_echo 'object-inspect@1.0.2' > "${DEFAULT_PACKAGES_FILE}"
# precondition: the already-installed target must not have the default package yet
nvm use 9.10.0
npm list --global --depth=0 | grep object-inspect > /dev/null && die "object-inspect should not be installed on v9.10.0 before default-packages test"
nvm install 9.10.0 > /dev/null 2>&1 || die "nvm install 9.10.0 (already installed, default-packages) failed"
nvm use 9.10.0
npm list --global --depth=0 | grep object-inspect > /dev/null || die "default packages were not installed on already-installed v9.10.0"
# restore the default-packages file before the next assertion
cleanup
# ...and `--alias` must be set on the already-installed path too.
TEST_ALIAS='nvm-3858-already-installed'
nvm unalias "${TEST_ALIAS}" > /dev/null 2>&1 || true # ensure a clean precondition
nvm install --alias="${TEST_ALIAS}" 9.10.0 > /dev/null 2>&1 || die "nvm install --alias=${TEST_ALIAS} 9.10.0 (already installed) failed"
TERM=dumb nvm alias "${TEST_ALIAS}" | grep 'v9.10.0' > /dev/null || die "--alias was not set on already-installed v9.10.0"
cleanup