Skip to content

Commit a99b8b0

Browse files
msaladnaljharb
authored andcommitted
Add test for NVM_DIR outside nvm.sh
1 parent 2cfe795 commit a99b8b0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
die () { echo "$@" ; exit 1; }
6+
7+
INSTPATH="$(mktemp -p "$(pwd)" -d)"
8+
trap 'test ! -z "${INSTPATH-}" && test -d "$INSTPATH" && rm -rf "$INSTPATH"' EXIT
9+
declare -x NVM_DIR=$INSTPATH
10+
\. ../../../nvm.sh
11+
12+
nvm install --lts || die 'nvm install --lts failed'
13+
nvm exec --lts npm --version || die "`nvm exec` failed to run"
14+
declare -x NODE_VERSION="$(nvm exec --lts --silent node --version)"
15+
16+
ln -s ../../../../nvm-exec "$INSTPATH/nvm-exec" || die "failed to create a symlink to $INSTPATH/"
17+
"$INSTPATH/nvm-exec" npm ls > /dev/null || die "`nvm exec` failed to run using nvm-exec helper"
18+

0 commit comments

Comments
 (0)