Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(test): use direct Node launcher on macOS

morluto13f3372a8bea
diff --git a/scripts/verify-package-environment.d.mts b/scripts/verify-package-environment.d.mts
new file mode 100644
index 000000000..9f1b3c55f
--- /dev/null
+++ b/scripts/verify-package-environment.d.mts
@@ -0,0 +1,26 @@
+export interface PackageHopperEnvironment {
+ readonly HOPPER_LAUNCHER_PATH: string;
+ readonly HOPPER_LOADER_ARGS_JSON: string;
+}
+
+export function packageHopperEnvironment(
+ root: string,
+ platform?: string,
+): PackageHopperEnvironment;
+
+export function verifyPackageEnvironment(input: {
+ readonly root: string;
+ readonly workspace: string;
+ readonly evidenceRoot: string;
+ readonly referenceRoot: string;
+}): Promise<{
+ readonly prefix: string;
+ readonly home: string;
+ readonly npxLog: string;
+ readonly claudeConfig: string;
+ readonly codexConfig: string;
+ readonly codexTarget: string;
+ readonly cursorConfig: string;
+ readonly cursorTarget: string;
+ readonly environment: Readonly<Record<string, string | undefined>>;
+}>;
diff --git a/scripts/verify-package-environment.mjs b/scripts/verify-package-environment.mjs
index 8be43397d..574f32b34 100644
--- a/scripts/verify-package-environment.mjs
+++ b/scripts/verify-package-environment.mjs
@@ -92,9 +92,9 @@ export async function verifyPackageEnvironment({
};
}
-const packageHopperEnvironment = (root) => {
+export const packageHopperEnvironment = (root, platform = process.platform) => {
const fakeLauncher = join(root, "tests/fixtures/fakeLauncher.mjs");
- if (process.platform === "win32")
+ if (platform !== "linux")
return {
HOPPER_LAUNCHER_PATH: process.execPath,
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fakeLauncher]),
diff --git a/tests/packageInstallWorkflow.test.ts b/tests/packageInstallWorkflow.test.ts
index c386b0dfc..c6dd0071c 100644
--- a/tests/packageInstallWorkflow.test.ts
+++ b/tests/packageInstallWorkflow.test.ts
@@ -1,5 +1,6 @@
import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
+import { packageHopperEnvironment } from "../scripts/verify-package-environment.mjs";
describe("package installation workflows", () => {
it("runs package E2E without the retired native rebuild script", async () => {
@@ -77,4 +78,27 @@ describe("package installation workflows", () => {
expect(canary).toContain('mkdtemp(join(tmpdir(), "rea-published-canary-")');
expect(canary).toContain("cwd: canaryRoot");
});
+
+ it("uses direct Node ownership on macOS and Windows", () => {
+ const root = "/tmp/rea-package";
+ const expected = {
+ HOPPER_LAUNCHER_PATH: process.execPath,
+ HOPPER_LOADER_ARGS_JSON: JSON.stringify([
+ `${root}/tests/fixtures/fakeLauncher.mjs`,
+ ]),
+ };
+
+ expect(packageHopperEnvironment(root, "darwin")).toEqual(expected);
+ expect(packageHopperEnvironment(root, "win32")).toEqual(expected);
+ expect(packageHopperEnvironment(root, "linux")).toEqual({
+ HOPPER_LAUNCHER_PATH: "/bin/sh",
+ HOPPER_LOADER_ARGS_JSON: JSON.stringify([
+ "-c",
+ 'node_path=$1; shift; "$node_path" "$@"',
+ "rea-package-hopper",
+ process.execPath,
+ `${root}/tests/fixtures/fakeLauncher.mjs`,
+ ]),
+ });
+ });
});