mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-12-12 16:14:18 +00:00
Compare commits
4 Commits
v0.40.1
...
f0ee16f18d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0ee16f18d | ||
|
|
9a28dbd394 | ||
|
|
5f7d419458 | ||
|
|
b42c165667 |
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
@@ -58,12 +58,11 @@ jobs:
|
|||||||
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
- run: sudo ${{ matrix.shell }} --version 2> /dev/null || dpkg -s ${{ matrix.shell }} 2> /dev/null || which ${{ matrix.shell }}
|
||||||
- run: curl --version
|
- run: curl --version
|
||||||
- run: wget --version
|
- run: wget --version
|
||||||
- uses: ljharb/actions/node/run@main
|
- uses: ljharb/actions/node/install@main
|
||||||
name: 'npm install && version checks'
|
name: 'npm install && version checks'
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: 'lts/*'
|
||||||
skip-ls-check: true
|
skip-ls-check: true
|
||||||
shell-command: echo installed
|
|
||||||
- run: npm ls urchin
|
- run: npm ls urchin
|
||||||
- run: npx which urchin
|
- run: npx which urchin
|
||||||
- run: env
|
- run: env
|
||||||
|
|||||||
6
nvm.sh
6
nvm.sh
@@ -4514,7 +4514,11 @@ nvm_supports_xz() {
|
|||||||
if [ "_${NVM_OS}" = '_darwin' ]; then
|
if [ "_${NVM_OS}" = '_darwin' ]; then
|
||||||
local MACOS_VERSION
|
local MACOS_VERSION
|
||||||
MACOS_VERSION="$(sw_vers -productVersion)"
|
MACOS_VERSION="$(sw_vers -productVersion)"
|
||||||
if nvm_version_greater "10.9.0" "${MACOS_VERSION}"; then
|
if tar --version | command grep -q GNU && ! command which xz >/dev/null 2>&1; then
|
||||||
|
# On macOS with GNU tar in use, and no xv on the path, xv-compressed
|
||||||
|
# tarballs aren't supported
|
||||||
|
return 1
|
||||||
|
elif nvm_version_greater "10.9.0" "${MACOS_VERSION}"; then
|
||||||
# macOS 10.8 and earlier doesn't support extracting xz-compressed tarballs with tar
|
# macOS 10.8 and earlier doesn't support extracting xz-compressed tarballs with tar
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
# Save the PATH as it was when the test started to restore it when it
|
# Save the PATH as it was when the test started to restore it when it
|
||||||
# finishes
|
# finishes
|
||||||
ORIG_PATH=$PATH
|
ORIG_PATH="${PATH}"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
# Restore the PATH as it was when the test started
|
# Restore the PATH as it was when the test started
|
||||||
export PATH=ORIG_PATH
|
export PATH="${ORIG_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
die () { cleanup; echo "$@" ; exit 1; }
|
die () { cleanup; echo "$@" ; exit 1; }
|
||||||
@@ -15,20 +15,23 @@ die () { cleanup; echo "$@" ; exit 1; }
|
|||||||
|
|
||||||
# Directory where mocked binaries used by nvm_get_arch for each OS/arch are
|
# Directory where mocked binaries used by nvm_get_arch for each OS/arch are
|
||||||
# located
|
# located
|
||||||
MOCKS_DIR=`pwd`/../../mocks
|
MOCKS_DIR="$(pwd)/../../mocks"
|
||||||
# Sets the PATH for these tests to include the symlinks to the mocked
|
# Sets the PATH for these tests to include the symlinks to the mocked
|
||||||
# binaries
|
# binaries
|
||||||
export PATH=.:${PATH}
|
export PATH=".:${PATH}"
|
||||||
|
|
||||||
# Setups mock binaries for a given OS and arch that mimic
|
# Setups mock binaries for a given OS and arch that mimic
|
||||||
# the output of the real binaries used by nvm_get_arch to guess
|
# the output of the real binaries used by nvm_get_arch to guess
|
||||||
# the architecture of a given system.
|
# the architecture of a given system.
|
||||||
setup_mock_arch() {
|
setup_mock_arch() {
|
||||||
local OS=$1
|
local OS
|
||||||
local ARCH=$2
|
OS=$1
|
||||||
local OPT=$3
|
local ARCH
|
||||||
|
ARCH=$2
|
||||||
|
local OPT
|
||||||
|
OPT=$3
|
||||||
|
|
||||||
if [ "_$OS" = "_solaris" ] || [ "_$OS" = "_smartos" ]; then
|
if [ "_${OS}" = '_solaris' ] || [ "_${OS}" = '_smartos' ]; then
|
||||||
ln -sf "${MOCKS_DIR}/isainfo_${ARCH}" ./isainfo
|
ln -sf "${MOCKS_DIR}/isainfo_${ARCH}" ./isainfo
|
||||||
if [ "_$OPT" != "_no_pkg_info" ]; then
|
if [ "_$OPT" != "_no_pkg_info" ]; then
|
||||||
ln -sf "${MOCKS_DIR}/pkg_info_${ARCH}" ./pkg_info
|
ln -sf "${MOCKS_DIR}/pkg_info_${ARCH}" ./pkg_info
|
||||||
@@ -42,10 +45,12 @@ setup_mock_arch() {
|
|||||||
|
|
||||||
# Cleans up the setup done by setup_mock_arch.
|
# Cleans up the setup done by setup_mock_arch.
|
||||||
cleanup_mock_arch() {
|
cleanup_mock_arch() {
|
||||||
local OS=$1
|
local OS
|
||||||
local ARCH=$2
|
OS=$1
|
||||||
|
local ARCH
|
||||||
|
ARCH=$2
|
||||||
|
|
||||||
if [ "_$OS" = "_solaris" ] || [ "_$OS" = "_smartos" ]; then
|
if [ "_${OS}" = '_solaris' ] || [ "_${OS}" = '_smartos' ]; then
|
||||||
rm -f ./isainfo
|
rm -f ./isainfo
|
||||||
rm -f ./pkg_info
|
rm -f ./pkg_info
|
||||||
fi
|
fi
|
||||||
@@ -57,17 +62,22 @@ cleanup_mock_arch() {
|
|||||||
# expected output $EXPECTED_OUTPUT with the actual output. Does nothing
|
# expected output $EXPECTED_OUTPUT with the actual output. Does nothing
|
||||||
# and exits cleanly if they match, dies otherwise.
|
# and exits cleanly if they match, dies otherwise.
|
||||||
run_test() {
|
run_test() {
|
||||||
local ARCH=$1
|
local ARCH
|
||||||
local OS=$2
|
ARCH=$1
|
||||||
local EXPECTED_OUTPUT=$3
|
local OS
|
||||||
local OPT=$4
|
OS=$2
|
||||||
|
local EXPECTED_OUTPUT
|
||||||
|
EXPECTED_OUTPUT=$3
|
||||||
|
local OPT
|
||||||
|
OPT=$4
|
||||||
|
|
||||||
setup_mock_arch $OS $ARCH $OPT
|
setup_mock_arch "${OS}" "${ARCH}" "${OPT}"
|
||||||
local OUTPUT="$(nvm_get_arch)"
|
local OUTPUT
|
||||||
cleanup_mock_arch $OS $ARCH
|
OUTPUT="$(nvm_get_arch)"
|
||||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] ||
|
cleanup_mock_arch "${OS}" "${ARCH}"
|
||||||
die "nvm_get_arch for OS \"$OS\" and arch \"$ARCH\" with OPT \"$OPT\" did
|
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] ||
|
||||||
not return \"$EXPECTED_OUTPUT\"; got \"$OUTPUT\""
|
die "nvm_get_arch for OS \"${OS}\" and arch \"${ARCH}\" with OPT \"${OPT}\" did
|
||||||
|
not return \"${EXPECTED_OUTPUT}\"; got \"${OUTPUT}\""
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test x86 smartos x86
|
run_test x86 smartos x86
|
||||||
|
|||||||
Reference in New Issue
Block a user