`STABLE` is only assigned inside the loop over `LAST_TWO`,
but it is echoed unconditionally afterwards.
With nothing installed, or with only an odd minor,
the loop never runs, so under `set -u` `nvm ls` dies on
`STABLE: unbound variable` instead of resolving `stable` to nothing.
`local STABLE` without an initializer also keeps the caller's value in sh and dash,
so `STABLE=x nvm ls stable` resolves the alias to something that isn't installed.
Initializing it where it is declared fixes both,
the way 139ed9c did for `PATTERN`, `NVM_LTS`, `LTS` and `VERSION`.
`local UNSTABLE` keeps the caller's value the same way,
which its `N/A` fallback doesn't cover, so it is initialized too.
The nounset test now covers the two states that leave `stable` unresolved,
and the caller test that `nvm ls stable` answers the same either way,
and that an outer `UNSTABLE` doesn't become the `unstable` alias.
Co-authored-by: NUAAwqy <146524024+NUAAwqy@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
`nvm_ls` decides whether a version dir is worth searching with `ls -1qA`, which
also counts dotfiles, but then collects versions with `find "${DIR}"/*`, which
never matches them. A dir holding nothing but hidden entries passes the guard,
so when `nullglob` is not set `find` is handed the literal `*` and `nvm ls`
prints "No such file or directory" to stderr.
Drop `-A` from the guard so both halves agree on what counts as an entry.
Fixes#3727.
nvm_ls collects installed versions with `find <dirs>/* -name . -o -type d -prune -o -path ...`,
and `-type d` is false for a symlink,
so a version dir that links to another volume was skipped from the listing entirely
- while `nvm version`, `nvm which` and `nvm use` all kept working on it.
Have that find follow symlinks,
which makes linked-in versions visible and still ignores a broken link.
Fixes#617.
Normalize `nvm_version` output when `nvm_ls` returns "system vX" so alias and .nvmrc resolutions treat system correctly.
Add fast tests for system alias behavior in `nvm ls`, `nvm use`, and `nvm which`.
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location.
Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
- fix test 'Running "nvm ls" should display all installed versions.': only expect versions created by this test, but no versions created by other tests
fast tests
alias
unalias
more alias tests
tests
document testing
warn not to run while testing
chmod +x deactivate
specify the version (commit) of urchin
installation test
run
tests for ls
switch unsetopt to the thing creationix has
rename tests
urchin log
adjust urchin version