16 Commits
Author SHA1 Message Date
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 c7d5d7748b [Tests] run every remaining test file: exec bits, fixes; add check-exec to CI
urchin only executes test files that have the executable bit, silently skipping the rest,
and `npm run test:check-exec` would catch non-executable ones, but no workflow ran it -
so several test files have never actually run.
Make all of them executable, and fix the ones that were broken:
- the io.js source-install tests, skipped since 2016: io.js requires python 2 and gcc <= 5,
so they now skip on toolchains that can not compile it,
and a new gcc:4.9-container CI job runs them unmodified -
resolving, downloading, checksumming, and compiling io.js for real.
New `fake source` variants exercise nvm's source pipeline everywhere -
cache lookup, offline resolution, extraction, configure, make, make install, activation -
via a tiny fake source tree seeded into the download cache and installed with `--offline`.
Also strengthen the `nvm run | grep` assertions with `--silent`,
since the version banner used to satisfy the grep even when the built binary could not run,
and give the final assertions the `die` they always meant to call.
- `nvm uninstall ... incorrect file permissions fails nicely`, parked in 2025 as failing:
`sudo npm` resets PATH, so node 5's npm crashed under the system node.
The permissions check only trips on files that are neither writable nor self-owned,
and that precondition only needs `sudo touch` - not npm, jspm, or the network -
so use that, against a fake installed version,
and skip only where passwordless sudo does not exist.
- `nvm install --offline`: `nvm ls | tail -1` always grabbed an alias line, never a version;
use `nvm_ls` and skip its trailing `system <version>` line.
- `nvm exec ... help should not parse`: in a BRE, `[options]` is a bracket expression,
so the grep could never match node's literal `Usage: node [options]` output.
- `nvm use ... nvmrc containing not installed version`: current output once again matches its expectations verbatim; no changes needed.

Rewrite `test:check-exec` in POSIX sh - npm runs scripts with /bin/sh, which is dash on Ubuntu,
where the previous `[[`/`$'\n'` bashisms would break;
match by extension, so that filenames containing dots can not dodge the check;
and disable git's `core.quotePath` mangling of the non-ASCII test filenames.
Then wire it into the lint workflow.
2026-07-09 22:40:07 -07:00
Atsushi YamamotoandJordan Harband 9f520c97db [Tests] nvm exec/nvm run: add --silent tests
Co-authored-by: Atsushi Yamamoto <yamaatsushi927@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2016-10-11 23:43:10 -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
Vesa VilhonenandSladyn Nunes 52f67b3677 [Fix] exec: -- should stop argument parsing
Co-authored-by: Vesa Vilhonen <vesa@vilhonen.com>
Co-authored-by: Sladyn Nunes <sladynnunes98@gmail.com>
2020-11-20 13:06:28 +02:00
nmarghetti 9849bf494d [meta] Rename some files to be more cross platform 2021-01-04 00:49:05 +01:00
Peter Dave Hello 2cd2c0f72e Remove useless trailing newlines 2018-02-26 01:01:30 +08:00
Peter Dave Hello f7763c8ba9 [Tests] die() in tests should quote "$@" for echo 2016-11-07 03:34:36 +08:00
Qiangjun Ran cadbbced20 [Tests] Replace all dots with backslash dots 2016-11-03 23:44:59 -07:00
Jordan Harband 58a82a1d31 [Tests] add nvm exec --lts tests. 2016-07-17 19:54:10 -07:00
Jordan Harband b2c5616d7a [Tests] avoid accidental command execution in test failure message. 2016-07-17 19:54:26 -07:00
Jordan Harband 6fb94e0dab [fix] nvm exec: show “io.js” for io.js versions. 2016-05-04 00:33:56 -07:00
Keiichiro Ui b76d43e9f8 Fix nvm-exec for the commands includes white-spaces 2015-12-24 19:48:35 +09:00
Jordan Harband 6c89e96f67 Ensure that we don't try to uninstall the current version of node in test teardowns. 2014-10-09 00:19:14 -07:00
Jordan Harband 1fa2acf5a7 Adding nvm exec tests. 2014-08-02 15:43:04 -07:00