mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
???
This commit is contained in:
parent
f6f5b20a8f
commit
59398622a6
53
test/installation_node/install while copying certs
Executable file
53
test/installation_node/install while copying certs
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Save the PATH as it was when the test started to restore it when it
|
||||
# finishes
|
||||
ORIG_PATH=$PATH
|
||||
|
||||
cleanup() {
|
||||
# Restore the PATH as it was when the test started
|
||||
export PATH=ORIG_PATH
|
||||
rm $TEMPFILE
|
||||
unset TEMPFILE
|
||||
}
|
||||
|
||||
die () { cleanup; echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../nvm.sh
|
||||
|
||||
# Directory where mocked npm-config is located
|
||||
MOCKS_DIR=`pwd`/../../mocks
|
||||
TEMPFILE="${MOCKS_DIR}/temp"
|
||||
|
||||
# Sets the PATH for these tests to include the symlinks to the mocked
|
||||
# binaries
|
||||
export PATH=.:${PATH}
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e "${NVM_DIR}/versions/node/v9.7.0" ] && rm -R "${NVM_DIR}/versions/node/v9.7.0"
|
||||
[ -e "${NVM_DIR}/versions/node/v9.10.0" ] && rm -R "${NVM_DIR}/versions/node/v9.10.0"
|
||||
|
||||
# set the
|
||||
# Install from binary
|
||||
nvm install 9.7.0
|
||||
|
||||
# Check
|
||||
[ -d "${NVM_DIR}/versions/node/v9.7.0" ] || die "nvm install 9.7.0 didn't install"
|
||||
|
||||
nvm use 9.7.0
|
||||
|
||||
node --version | grep v9.7.0 > /dev/null || die "nvm use 9.7.0 failed"
|
||||
|
||||
npm install -g object-is@0.0.0 || die "npm install -g object-is failed"
|
||||
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
|
||||
|
||||
nvm ls 9 | grep v9.7.0 > /dev/null || die "nvm ls 9 didn't show v9.7.0"
|
||||
|
||||
nvm install 9.10.0 --reinstall-packages-from=9 || die "nvm install 9.10.0 --reinstall-packages-from=9 failed"
|
||||
|
||||
[ -d "${NVM_DIR}/versions/node/v9.10.0" ] || die "nvm install 9.10.0 didn't install"
|
||||
|
||||
nvm use 9
|
||||
node --version | grep v9.10.0 > /dev/null || die "nvm ls 9 didn't use v9.10.0"
|
||||
|
||||
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
|
13
test/mocks/npm_config
Normal file
13
test/mocks/npm_config
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
shift
|
||||
|
||||
if [ "$1" = "get" ]; then
|
||||
cat "$TEMPFILE"
|
||||
elif [ "$1" = "set" ]; then
|
||||
shift
|
||||
name="$1"
|
||||
shift
|
||||
val="$*"
|
||||
echo "${name} = ${val}" >> "$TEMPFILE"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user