-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix]
nvm exec
: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/fast/Running 'nvm-exec' should display required node version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
\. ../../nvm.sh | ||
|
||
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 | ||
diff <(echo "${EXPECTED}") <(echo "${OUTPUT}") |