Skip to content

Commit 2cba2f7

Browse files
jumbosushiljharb
andcommitted
[Tests] nvm exec/nvm run: add --silent tests
Co-authored-by: Atsushi Yamamoto <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
1 parent 247ed8a commit 2cba2f7

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
die () { echo "$@" ; exit 1; }
6+
7+
. ../../../nvm.sh
8+
9+
echo "0.10.7" > .nvmrc
10+
11+
# Check nvm run without --silent
12+
OUTPUT="$(nvm run --version)"
13+
EXPECTED_OUTPUT="
14+
Found '${PWD}/.nvmrc' with version <0.10.7>
15+
Running node v0.10.7 (npm v1.2.17)
16+
v0.10.7"
17+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] \
18+
|| die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<"
19+
20+
OUTPUT="$(nvm run --silent --version)"
21+
EXPECTED_OUTPUT="v0.10.7"
22+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] \
23+
|| die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<"
24+
25+
# Output shouldn't be silent if --silent flag is not at the third argument position
26+
OUTPUT="$(nvm run --version --silent)"
27+
EXPECTED_OUTPUT=""
28+
[ "${OUTPUT}" != "${EXPECTED_OUTPUT}" ] \
29+
|| die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"

0 commit comments

Comments
 (0)