Files
nvm/test/fast/Running 'nvm-exec' should display required node version
Peter Dave Hello 5533699ec5 Improve uninstall error message for missing versions
Include the requested version in the uninstall error output when

the target is not installed.

Add a fast test to lock the behavior.

Close #3767
2026-01-30 00:04:01 +08:00

25 lines
563 B
Bash
Executable File

#!/bin/bash
set -x
: nvm.sh
\. ../../nvm.sh
cleanup() { rm -f .nvmrc; }
die () { echo "$@" ; cleanup ; exit 1; }
NVM_TEST_VERSION=v0.42
# Write it to nvmrc
echo "$NVM_TEST_VERSION" > .nvmrc
OUTPUT="$(../../nvm-exec 2>&1)";
EXPECTED="N/A: version \"${NVM_TEST_VERSION}\" is not yet installed.
You need to run \`nvm install ${NVM_TEST_VERSION}\` to install and use it.
No NODE_VERSION provided; no .nvmrc file found";
# Skip install, we want to test the error message
[ "${EXPECTED}" = "${OUTPUT}" ] || die "expected >${EXPECTED}<, got >${OUTPUT}<"
cleanup