mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
[Tests] nvm exec
/nvm run
: add --silent
tests
Co-authored-by: Atsushi Yamamoto <yamaatsushi927@gmail.com> Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
parent
e5521cfd3c
commit
9f520c97db
28
test/slow/nvm run/Running 'nvm run --silent' should work
Executable file
28
test/slow/nvm run/Running 'nvm run --silent' should work
Executable file
@ -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"
|
Loading…
Reference in New Issue
Block a user