Files
pnpm/pnpm11/engine/runtime/node-resolver/test/normalizeArch.test.ts
Zoltan Kochan 8d7294c76f fix(runtime): support win-arm64 architecture for Node.js runtime resolution (#15386)
Node.js publishes native `win-arm64.zip` archives starting with Node.js 20. Prior releases only publish `win-x64.zip` archives and execute under Windows on ARM emulation.

This change updates architecture normalization and target matching for `win32-arm64`:
- Resolves native `node-v${version}-win-arm64.zip` for Node >= 20.
- Falls back to `node-v${version}-win-x64.zip` for Node < 20.
- Implements this behavior in both the TypeScript pnpm 11 engine-runtime-node-resolver and the Rust pnpm 12 engine-runtime-node-resolver.

Closes pnpm/pnpm#7123
2026-09-23 21:01:35 +02:00

29 lines
949 B
TypeScript

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