Files
nvm/test/fast
NUAAwqyandJordan Harband 7ab48a653b [Fix] nvm_print_implicit_alias: keep STABLE bound, and STABLE and UNSTABLE independent of the caller
`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>
2026-10-29 17:08:50 +00:00
..