mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-30 09:18:59 +08:00
[Tests] move tests that fail on focal to a separate suite that runs on xenial
This commit is contained in:
45
test/xenial/install hook
Executable file
45
test/xenial/install hook
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
. ../../nvm.sh
|
||||
|
||||
VERSION='v0.11.0'
|
||||
VERSION_PATH="$(nvm_version_path "${VERSION}")"
|
||||
|
||||
succeed() {
|
||||
nvm_echo "$@"
|
||||
NVM_INSTALL_THIRD_PARTY_HOOK= nvm install "${VERSION}"
|
||||
}
|
||||
|
||||
fail() {
|
||||
succeed "$@"
|
||||
return 11
|
||||
}
|
||||
|
||||
! nvm_is_version_installed "${VERSION}" || nvm uninstall "${VERSION}" || die 'uninstall failed'
|
||||
|
||||
# an existing but empty VERSION_PATH directory should not be enough to satisfy nvm_is_version_installed
|
||||
rm -rf "${VERSION_PATH}"
|
||||
mkdir -p "${VERSION_PATH}"
|
||||
nvm_is_version_installed "${VERSION}" && die 'nvm_is_version_installed check not strict enough'
|
||||
rmdir "${VERSION_PATH}"
|
||||
|
||||
OUTPUT="$(NVM_INSTALL_THIRD_PARTY_HOOK=succeed nvm install "${VERSION}")"
|
||||
USE_OUTPUT="$(nvm use "${VERSION}")"
|
||||
EXPECTED_OUTPUT="${VERSION} node std binary ${VERSION_PATH}
|
||||
Downloading and installing node ${VERSION}...
|
||||
${USE_OUTPUT}"
|
||||
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
|
||||
! nvm_is_version_installed "${VERSION}" || nvm uninstall "${VERSION}" || die 'uninstall 2 failed'
|
||||
|
||||
OUTPUT="$(NVM_INSTALL_THIRD_PARTY_HOOK=fail nvm install "${VERSION}" || echo 'failed')"
|
||||
USE_OUTPUT="$(nvm use "${VERSION}")"
|
||||
EXPECTED_OUTPUT="${VERSION} node std binary ${VERSION_PATH}
|
||||
Downloading and installing node ${VERSION}...
|
||||
${USE_OUTPUT}
|
||||
failed"
|
||||
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
Reference in New Issue
Block a user