Skip to content

Commit d11bc3f

Browse files
committed
Add tests for "nvm run --silent"
1 parent 57a600a commit d11bc3f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 | awk '{print $6}')"
13+
EXPECTED_OUTPUT="<v0.10.7>"
14+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] /
15+
|| die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<"
16+
17+
OUTPUT="$(nvm run --silent --version)"
18+
EXPECTED_OUTPUT=""
19+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] /
20+
|| die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<"
21+
22+
# Output shouldn't be silent if --silent flag is not at the third argument position
23+
OUTPUT="$(nvm run --version --silent)"
24+
EXPECTED_OUTPUT=""
25+
[ "${OUTPUT}" -ne "${EXPECTED_OUTPUT}" ] /
26+
|| die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"

0 commit comments

Comments
 (0)