[Tests] try to make `nvm unload` test more robust

Jordan Harband 2020-02-09 06:41:52 -10:00
parent 6c560b12b6
commit 4cd6b4822c
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 3 additions and 3 deletions

View File

@ -5,11 +5,11 @@ set -ex
BEFORE="./before.tmp"
AFTER="./after.tmp"
cleanup () { rm -f "${BEFORE}" "${AFTER}"; }
cleanup () { echo rm -f "${BEFORE}" "${AFTER}"; }
die () { echo "$@" ; cleanup ; exit 1; }
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
env | grep -v PATH= | grep -v NVM_ >> "${BEFORE}"
env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | sort >> "${BEFORE}"
set +e # TODO: fix
\. ../../nvm.sh
@ -20,7 +20,7 @@ type nvm > /dev/null 2>&1 || die "nvm not loaded"
nvm unload
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"
env | grep -v PATH= >> "${AFTER}"
env | grep -v PATH= | grep -v IFS= | sort >> "${AFTER}"
! type nvm > /dev/null 2>&1 || die "nvm not unloaded"