mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-12-02 21:28:55 +03:00
[Tests] pin --lts and node installs to end-of-life lines, so a new node release can't break them
`nvm install --lts` and `nvm install node` resolve to whatever is newest on nodejs.org, so a partial release (eg, v26.13.0, published to `index.tab` before its `SHASUMS256.txt`) these tests fail without any change to nvm. `nvm exec --lts` and `nvm run --lts` now run against v18.20.8, with `lts/*` pointed at `lts/hydrogen` after setup's installs (which rewrite the LTS aliases), and restored in teardown. The `set -E` test now installs `9`, which still resolves remotely, since the ERR trap handling it covers is in `nvm()` itself. See https://github.com/nodejs/node/issues/67087
This commit is contained in:
6 files changed
+17
-6
No files matched your search
@@ -36,7 +36,8 @@ ERR_TRAP_EXPECTED="$(trap -p ERR)"
|
||||
# Adding ` || die 'install failed'` implicitly disables error handling and
|
||||
# prevents ERR trap execution, so for the purposes of this test, `nvm install`
|
||||
# can't be part of another command or statement
|
||||
nvm install node
|
||||
VERSION=9 # an end-of-life major, so that a new node release can't change what this installs
|
||||
nvm install "${VERSION}"
|
||||
|
||||
case "$-" in
|
||||
*E*)
|
||||
|
||||
@@ -6,7 +6,7 @@ die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
nvm install --lts || die 'nvm install --lts failed'
|
||||
nvm use --lts || die 'nvm use --lts failed'
|
||||
|
||||
NPM_VERSION_LTS="$(npm --version)"
|
||||
TEST_STRING="foo bar"
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
\. ../../../nvm.sh
|
||||
nvm install 0.10.7
|
||||
nvm install 1.0.0
|
||||
nvm install --lts
|
||||
nvm install 18.20.8
|
||||
|
||||
# pin `lts/*` to an end-of-life LTS line, so that a new LTS release can't change what `--lts` selects
|
||||
cp "$(nvm_alias_path)/lts/*" "${NVM_DIR}/.nvm_exec_lts_alias_bak"
|
||||
nvm_make_alias 'lts/*' lts/hydrogen
|
||||
|
||||
if [ -f ".nvmrc" ]; then
|
||||
mv .nvmrc .nvmrc.bak
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
nvm deactivate
|
||||
nvm uninstall v0.10.7
|
||||
nvm uninstall v1.0.0
|
||||
nvm uninstall --lts
|
||||
nvm uninstall v18.20.8
|
||||
mv "${NVM_DIR}/.nvm_exec_lts_alias_bak" "$(nvm_alias_path)/lts/*"
|
||||
|
||||
rm .nvmrc
|
||||
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
nvm install 0.10.7
|
||||
nvm install --lts=argon
|
||||
nvm install --lts
|
||||
nvm install 18.20.8
|
||||
|
||||
# pin `lts/*` to an end-of-life LTS line, so that a new LTS release can't change what `--lts` selects
|
||||
cp "$(nvm_alias_path)/lts/*" "${NVM_DIR}/.nvm_run_lts_alias_bak"
|
||||
nvm_make_alias 'lts/*' lts/hydrogen
|
||||
|
||||
if [ -f ".nvmrc" ]; then
|
||||
mv .nvmrc .nvmrc.bak
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
nvm deactivate
|
||||
nvm uninstall v0.10.7
|
||||
nvm uninstall --lts=argon
|
||||
nvm uninstall --lts
|
||||
nvm uninstall v18.20.8
|
||||
mv "${NVM_DIR}/.nvm_run_lts_alias_bak" "$(nvm_alias_path)/lts/*"
|
||||
|
||||
rm .nvmrc
|
||||
|
||||
|
||||
Reference in new issue
Block a user