[patch] show system Node.js version in nvm ls

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`.
This commit is contained in:
Peter Dave Hello
2026-01-25 18:19:50 +08:00
committed by Jordan Harband
parent b1dd81097f
commit 29a652f90f
8 changed files with 189 additions and 4 deletions

View File

@@ -34,6 +34,9 @@ nvm_ls() {
[ "_$(nvm_version node)" = "_pattern: stable" ] || die '"nvm_version node" did not pass "stable" to "nvm_ls"'
[ "_$(nvm_version node-)" = "_pattern: stable" ] || die '"nvm_version node-" did not pass "stable" to "nvm_ls"'
nvm_ls() { echo "system v20.0.0"; }
[ "_$(nvm_version system)" = "_system" ] || die '"nvm_version system" did not return "system" when "nvm_ls" returns extra columns'
nvm_ls() { echo "N/A"; }
OUTPUT="$(nvm_version foo)"
EXPECTED_OUTPUT="N/A"