Skip to content

Commit

Permalink
[Tests] nvm exec/nvm run: add --silent tests
Browse files Browse the repository at this point in the history
Co-authored-by: Atsushi Yamamoto <[email protected]>
Co-authored-by: Jordan Harband <[email protected]>
  • Loading branch information
jumbosushi and ljharb committed Oct 12, 2016
1 parent e5521cf commit 9f520c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/slow/nvm run/Running 'nvm run --silent' should work
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -ex

die () { echo "$@" ; exit 1; }

. ../../../nvm.sh

echo "0.10.7" > .nvmrc

# Check nvm run without --silent
OUTPUT="$(nvm run --version)"
EXPECTED_OUTPUT="Found '${PWD}/.nvmrc' with version <0.10.7>
Running node v0.10.7 (npm v1.2.21)
v0.10.7"
[ ">${OUTPUT}<" = ">${EXPECTED_OUTPUT}<" ] \
|| die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<"

OUTPUT="$(nvm run --silent --version)"
EXPECTED_OUTPUT="v0.10.7"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] \
|| die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<"

# Output shouldn't be silent if --silent flag is not at the third argument position
OUTPUT="$(nvm run --version --silent)"
EXPECTED_OUTPUT=""
[ "${OUTPUT}" != "${EXPECTED_OUTPUT}" ] \
|| die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"

0 comments on commit 9f520c9

Please sign in to comment.