Skip to content

Commit

Permalink
Fix: nvm use test case
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakchethan committed Apr 4, 2022
1 parent c86bc5b commit 6bc56d4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ die () { echo "$@" ; exit 1; }

echo "0.10.7" > .nvmrc

[ "$(nvm run --version | tail -1)" = "v0.10.7" ] || die "\`nvm run\` failed to run with the .nvmrc version"

[ "$(nvm run --version | head -1)" = "Found '$PWD/.nvmrc' with version <0.10.7>" ] || die "\`nvm run\` failed to print out the \"found in .nvmrc\" message"


echo "foo" > .nvmrc

# running nvm run with .nvmrc should not print the version information when not installed
OUTPUT="$(nvm run --version 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT="Found '$PWD/.nvmrc' with version <0.10.7>
N/A: version \"v0.10.7\" is not yet installed.
EXPECTED_OUTPUT="Found '$PWD/.nvmrc' with version <foo>
N/A: version \"foo\" is not yet installed.
You need to run \`nvm install\` to install and use the node version specified in \`.nvmrc\`."
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm use' with nvmrc to give $EXPECTED_OUTPUT, got $OUTPUT"
Expand Down

0 comments on commit 6bc56d4

Please sign in to comment.