Commit Graph
38 Commits
Author SHA1 Message Date
Peter Dave Hello eb0c8b95c8 [Tests] Verify explicit make jobs without redundant source builds
Exercise both argument orders and multiple job counts against the existing fake source fixture,
checking the actual build and install make arguments.
Use an isolated offline cache and a conflicting inherited job count to catch regressions that a successful real compilation alone cannot detect.

Keep a real source build with explicit jobs in each installation suite,
but remove the redundant serial compilation and make installation failures and version mismatches fail the test immediately.
2026-11-26 03:13:13 +08:00
Jordan Harband 5e38bc0cae [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
2026-10-28 10:37:00 -07:00
Jordan Harband e2e612e722 [Tests] installation_node: only match top-level global packages 2026-07-02 15:49:01 -05:00
Jordan Harband 041a57747a [Tests] installation_node: use a published is-nan version
`is-nan@1.0.0` was published on 2014-07-05 and unpublished minutes later
(the registry's `time` map still lists it, but `versions` jumps from `0.0.0` to `1.0.1`),
so `npm install -g is-nan@1.0.0` fails with `ETARGET`,
and the regression test added in ce157343 fails deterministically in every shell.

See https://github.com/nvm-sh/nvm/actions/runs/28407118533
2026-07-02 14:35:57 -05:00
Jordan Harband ce15734300 [Fix] nvm install: migrate packages/set alias when target is already installed
When `nvm install <target>` found that `<target>` was already installed,
the post-`nvm use` steps
(`--reinstall-packages-from`, default packages, and `--alias`/`--default`)
were gated on `[ $EXIT_CODE -ne 0 ]`.
Since that branch is only entered when `nvm use` succeeded (EXIT_CODE == 0),
those conditions were always false, so the steps were silently skipped.

The fresh-install branch correctly uses `-eq 0`;
mirror that here so `--reinstall-packages-from` actually migrates global packages
(and the alias/default get set) when the target version already exists.

Includes a regression test covering the already-installed path.

Fixes #3858
2026-06-29 16:39:19 -05:00
Dick Marinus 790ffd2682 [Fix] fix same owner for root when install from binary
GNU Tar has `--preserve-permissions` as a default enabled when executed as the superuser (root).
This will cause the binaries to be installed using the permissions (owner and group) as defined in the tarball.

The argument `--no-same-owner` prevents this and will install the binaries as the effective owner/group just like when nvm is executed as a non superuser.

Updated the install from binary test from the installation_node test
suite because this test is run in a docker container as root. Without
--no-same-owner this test will fail beause the binaries of node v0.10.7
are owned by isaacs/admin in the tarball.
2026-05-05 15:40:32 -07:00
Jordan Harband 4c3edc5e56 [actions] migrate Travis CI tests to GitHub Actions 2026-01-27 10:31:07 -08:00
Jordan Harband da2720a429 [Fix] nvm ls, nvm alias, nvm install: error when an LTS name is invalid 2024-09-04 13:55:11 -07:00
Jordan Harband ff7634577b [Tests] fix broken tests exposed by 863bd63
Leaves 2 non-executable, + some TODOs
2024-08-27 12:46:40 -07:00
Jordan Harband 863bd63cfa [Tests] set proper permissions on test files 2024-08-23 17:23:12 -07:00
Jordan Harband bf438742a7 [Tests] move installation_node tests back to xenial 2022-12-22 16:16:10 -08:00
Jordan Harband 447940acb3 [Tests] move tests that fail on focal to a separate suite that runs on xenial 2022-12-22 11:26:27 -08:00
Luke Arms 81f0f3ec19 [Fix] set -E: Add test for node install on Bash with an ERR trap and set -E 2021-12-27 16:02:25 +11:00
Jordan Harband ebbd30eb7f [Fix] nvm install-latest-npm: ensure npm 8 does not install on unsupported nodes 2021-10-05 15:13:45 -07:00
Jordan Harband 07c02d43fe [Tests] nvm install-latest-npm: node < 0.10 breaks with npm with dropped support for TLS < 1.2 2021-09-29 10:47:34 -07:00
Sladyn Nunes 4fdef427e4 [New] install: add -b flag to skip building from source
Fixes #2114.
2021-02-16 19:34:23 +05:30
a5aec107df [New] adding default and alias option to nvm install
For: `nvm install 8.12.0` after install:

--alias=8 is equivalent to `nvm alias 8 8.12.0`
--default is equivalent to `nvm alias default 8.12.0`

Co-authored-by: Kayla Altepeter <kayla@kaylaaltepeter.com>
Co-authored-by: Dena Burd <me@Denas-MacBook-Air.local>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2018-10-22 08:32:29 -05:00
Jordan Harband 6575b6b052 [Fix] install: improved arg parsing around --reinstall-packages-from
Fixes #1762
2020-06-04 16:15:39 -07:00
Jordan Harband db19450caa [Fix] default_packages: work when the file lacks a trailing newline
Fixes #1995.
2019-02-02 13:45:11 -08:00
Jordan Harband 5c117e6ab3 [Refactor] extract “get default packages” logic to nvm_get_default_packages 2019-02-01 13:27:18 -08:00
Jordan Harband e7a37f336d [Tests] fix failing tests on master due to npm registry SSL changes 2018-08-15 15:01:47 -07:00
Joshua Li 0cdc184168 [Fix] Improve nvm_is_version_installed to check for a node executable instead of root dir 2018-05-31 15:26:30 -07:00
Peter Dave Hello 41ec44f6b5 Add missing final newline in test script 2018-02-26 01:02:41 +08:00
Peter Dave Hello 2cd2c0f72e Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
Phileas Lebada be171bba33 Add unset-variable as exit error 2017-11-15 17:19:05 +01:00
Jordan Harband c0b56d03a1 [Fix] install-latest-npm: io.js v1.0.x has weird behavior with npm v4.6.x.
- comment out node 0.6 test due to travis-ci breakage
2017-09-07 15:57:09 -07:00
Jordan Harband cbdd41eee2 [New] nvm install: add --latest-npm option to automatically try to upgrade to the latest working version of npm.
- also add `nvm install-latest-npm` top-level command
2017-06-11 14:15:04 -07:00
Peter Dave Hello a66a9caa1c [Tests] Use node v0.10.7 for thread para test as other install from src tests 2017-04-09 13:08:04 +08:00
Jordan Harband b9f9977cdd [Fix] nvm install -s: npm detection
- add `nvm_use_if_needed`
 - add `nvm_install_npm_if_needed`
2017-03-27 15:00:50 -07:00
Jordan Harband affcc5087c [Fix] set -e: nvm install lts/something: call nvm_ensure_default_set with the proper value.
Fixes #1394.
2017-02-11 23:19:29 -08:00
Peter Dave Hello 9c92b5a4ea [New] nvm install: Print the version that is being installed 2016-11-06 20:43:47 +08:00
Peter Dave Hello f7763c8ba9 [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
Jordan Harband 24f8ae5c46 [New] support external install hook “$NVM_INSTALL_THIRD_PARTY_HOOK”.
Fixes #1207.
2016-11-03 23:42:55 -07:00
Qiangjun Ran cadbbced20 [Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Jordan Harband 54cc3a383e [Tests] set -ex options on more tests 2016-08-14 09:48:25 -07:00
Jordan Harband 655830eb58 [Tests] nvm install --lts: add tests 2016-06-26 13:57:01 -07:00
Jordan Harband 73aa35f508 [Tests] use $NVM_DIR instead of relative paths 2016-06-26 15:52:26 -07:00
Jordan Harband c9b7ccdaea Run node and io.js installation test suites separately. 2016-05-08 22:21:33 -07:00