[Fix] nvm install -b: when no binary is available, fail and output a clear message

This commit is contained in:
Jordan Harband
2024-08-01 13:57:22 -07:00
parent 423ee82b4c
commit 271720ebfc
2 changed files with 38 additions and 16 deletions

View File

@@ -0,0 +1,16 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh
VERSION="0.7.0"
EXIT_CODE=$(nvm install -b "${VERSION}" ; echo $?)
[ $EXIT_CODE -eq 3 ] || die "Expected exit code 3, got ${EXIT_CODE}"
ACTUAL="$(nvm install -b "${VERSION}" 2>&1)"
EXPECTED="Binary download is not available for v${VERSION}"
[ "${ACTUAL}" = "${EXPECTED}" ] || die "Expected >${EXPECTED}<, got >${ACTUAL}<"