mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-17 17:41:50 +00:00
Add test for NVM_DIR outside nvm.sh
This commit is contained in:
parent
9dc29fd8eb
commit
c74c74eb0a
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
die () { echo "$@" ; exit 1; }
|
||||||
|
|
||||||
|
INSTPATH="$(mktemp -p "$(pwd)" -d)"
|
||||||
|
trap 'test ! -z "${INSTPATH-}" && test -d "$INSTPATH" && rm -rf "$INSTPATH"' EXIT
|
||||||
|
declare -x NVM_DIR=$INSTPATH
|
||||||
|
\. ../../../nvm.sh
|
||||||
|
|
||||||
|
nvm install --lts || die 'nvm install --lts failed'
|
||||||
|
nvm exec --lts npm --version || die "`nvm exec` failed to run"
|
||||||
|
declare -x NODE_VERSION="$(nvm exec --lts --silent node --version)"
|
||||||
|
|
||||||
|
ln -s ../../../../nvm-exec "$INSTPATH/nvm-exec" || die "failed to create a symlink to $INSTPATH/"
|
||||||
|
"$INSTPATH/nvm-exec" npm ls > /dev/null || die "`nvm exec` failed to run using nvm-exec helper"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user