mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-19 20:13:44 +00:00
Compare commits
3 Commits
0d7927a9d1
...
02fab88e1f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
02fab88e1f | ||
![]() |
6b70c40f15 | ||
![]() |
639aaf9cd5 |
5
nvm.sh
5
nvm.sh
@ -196,6 +196,9 @@ nvm_install_latest_npm() {
|
|||||||
nvm_echo 'Attempting to upgrade to the latest working version of npm...'
|
nvm_echo 'Attempting to upgrade to the latest working version of npm...'
|
||||||
local NODE_VERSION
|
local NODE_VERSION
|
||||||
NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")"
|
NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")"
|
||||||
|
local NPM_VERSION
|
||||||
|
NPM_VERSION="$(npm --version 2>/dev/null)"
|
||||||
|
|
||||||
if [ "${NODE_VERSION}" = 'system' ]; then
|
if [ "${NODE_VERSION}" = 'system' ]; then
|
||||||
NODE_VERSION="$(node --version)"
|
NODE_VERSION="$(node --version)"
|
||||||
elif [ "${NODE_VERSION}" = 'none' ]; then
|
elif [ "${NODE_VERSION}" = 'none' ]; then
|
||||||
@ -206,8 +209,6 @@ nvm_install_latest_npm() {
|
|||||||
nvm_err 'Unable to obtain node version.'
|
nvm_err 'Unable to obtain node version.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local NPM_VERSION
|
|
||||||
NPM_VERSION="$(npm --version 2>/dev/null)"
|
|
||||||
if [ -z "${NPM_VERSION}" ]; then
|
if [ -z "${NPM_VERSION}" ]; then
|
||||||
nvm_err 'Unable to obtain npm version.'
|
nvm_err 'Unable to obtain npm version.'
|
||||||
return 2
|
return 2
|
||||||
|
26
test/slow/nvm run/Running 'nvm run --silent' should work
Executable file
26
test/slow/nvm run/Running 'nvm run --silent' should work
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../../nvm.sh
|
||||||
|
|
||||||
|
echo "0.10.7" > .nvmrc
|
||||||
|
|
||||||
|
# Check nvm run without --silent
|
||||||
|
OUTPUT="$(nvm run --version | awk '{print $6}' | head -1)"
|
||||||
|
EXPECTED_OUTPUT="<0.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=""
|
||||||
|
[ "${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…
x
Reference in New Issue
Block a user