From e9294ee66fcd49eec0c17d4e78f64b99b4e17f5c Mon Sep 17 00:00:00 2001 From: Yuchen Shi Date: Thu, 29 Aug 2024 18:27:58 -0700 Subject: [PATCH 1/2] Fix install.sh refusing to download macos-arm64 standalone. --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index fd44adb2abe6..81c1ce68edcd 100755 --- a/install.sh +++ b/install.sh @@ -461,9 +461,9 @@ npm_fallback() { # Determine if we have standalone releases on GitHub for the system's arch. has_standalone() { case $ARCH in - amd64) return 0 ;; - # We only have amd64 for macOS. - arm64) + arm64) return 0 ;; + # We only have arm64 for macOS. + amd64) [ "$(distro)" != macos ] return ;; From 8b7db680189f674686219dc108f6f64f60d1c59c Mon Sep 17 00:00:00 2001 From: Yuchen Shi Date: Fri, 30 Aug 2024 14:13:34 -0700 Subject: [PATCH 2/2] Update tests for macos-arm64 and amd64. --- test/scripts/install.bats | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/scripts/install.bats b/test/scripts/install.bats index 976069cd4443..67e64c9192a3 100644 --- a/test/scripts/install.bats +++ b/test/scripts/install.bats @@ -132,15 +132,15 @@ function should-use-standalone() { # macOS use homebrew but falls back to standalone when brew is unavailable then # to npm for unsupported architectures. -@test "$SCRIPT_NAME: macos arm64 (no brew)" { - should-fallback-npm-brew "arm64" -} @test "$SCRIPT_NAME: macos amd64 (no brew)" { - BREW_PATH= OS=macos ARCH=amd64 run "$SCRIPT" --dry-run + should-fallback-npm-brew "amd64" +} +@test "$SCRIPT_NAME: macos arm64 (no brew)" { + BREW_PATH= OS=macos ARCH=arm64 run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Homebrew not installed." ] [ "${lines[2]}" = "Falling back to standalone installation." ] - [ "${lines[3]}" = "Installing v$VERSION of the amd64 release from GitHub." ] + [ "${lines[3]}" = "Installing v$VERSION of the arm64 release from GitHub." ] [[ "${lines[-6]}" = "Standalone release has been installed"* ]] } @test "$SCRIPT_NAME: macos i386 (no brew)" {