Files
pnpm/packages/node.fetcher/test/normalizeArch.test.ts
Ambar Mutha 1c7b439bbe fix: node<16 download fail on arm chips on macos (#5239)
* fix(node.fetcher): node < 16 download fail on apple silicon

Add a check for macos apple silicon and required node version < 16.
In such case, download x64 binary.
Because arm build does not exist.
Previous behaviour:
Try to download non existing arm build and fail with 404.

NO breaking change
fixes #4489

* refactor(node.fetcher): move code to normalizeArch
2022-08-20 16:28:24 +03:00

18 lines
573 B
TypeScript

import normalizeArch from '../lib/normalizeArch'
test.each([
['win32', 'ia32', 'x86'],
['linux', 'arm', 'armv7l'], // Raspberry Pi 4
['linux', 'x64', 'x64'],
])('normalizedArch(%s, %s)', (platform, arch, normalizedArch) => {
expect(normalizeArch(platform, arch)).toBe(normalizedArch)
})
// macos apple silicon
test.each([
['darwin', 'arm64', '14.20.0', 'x64'],
['darwin', 'arm64', '16.17.0', 'arm64'],
])('normalizedArch(%s, %s)', (platform, arch, nodeVersion, normalizedArch) => {
expect(normalizeArch(platform, arch, nodeVersion)).toBe(normalizedArch)
})