Skip to content

Commit 9f520c9

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 e5521cf commit 9f520c9

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="Found '${PWD}/.nvmrc' with version <0.10.7>
14+
Running node v0.10.7 (npm v1.2.21)
15+
v0.10.7"
16+
[ ">${OUTPUT}<" = ">${EXPECTED_OUTPUT}<" ] \
17+
|| die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<"
18+
19+
OUTPUT="$(nvm run --silent --version)"
20+
EXPECTED_OUTPUT="v0.10.7"
21+
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] \
22+
|| die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<"
23+
24+
# Output shouldn't be silent if --silent flag is not at the third argument position
25+
OUTPUT="$(nvm run --version --silent)"
26+
EXPECTED_OUTPUT=""
27+
[ "${OUTPUT}" != "${EXPECTED_OUTPUT}" ] \
28+
|| die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"

0 commit comments

Comments
 (0)