Open History to see the last commit
1import { describe, expect, it } from "vitest";
2
3import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch";
4
5describe("resolveDesktopRuntimeInfo", () => {
6 it("detects Rosetta-translated Intel builds on Apple Silicon", () => {
7 const runtimeInfo = resolveDesktopRuntimeInfo({
8 platform: "darwin",
9 processArch: "x64",
10 runningUnderArm64Translation: true,
11 });
12
13 expect(runtimeInfo).toEqual({
14 hostArch: "arm64",
15 appArch: "x64",
16 runningUnderArm64Translation: true,
17 });
18 expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(true);
19 });
20
21 it("detects native Apple Silicon builds", () => {
22 const runtimeInfo = resolveDesktopRuntimeInfo({
23 platform: "darwin",
24 processArch: "arm64",
25 runningUnderArm64Translation: false,
26 });
27
28 expect(runtimeInfo).toEqual({
29 hostArch: "arm64",
30 appArch: "arm64",
31 runningUnderArm64Translation: false,
32 });
33 expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(false);
34 });
35
36 it("passes through non-mac builds without translation", () => {
37 const runtimeInfo = resolveDesktopRuntimeInfo({
38 platform: "linux",
39 processArch: "x64",
40 runningUnderArm64Translation: true,
41 });
42
43 expect(runtimeInfo).toEqual({
44 hostArch: "x64",
45 appArch: "x64",
46 runningUnderArm64Translation: false,
47 });
48 });
49});