fix(test): use direct Node launcher on macOS
This commit is contained in:
@@ -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>>;
|
||||||
|
}>;
|
||||||
@@ -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");
|
const fakeLauncher = join(root, "tests/fixtures/fakeLauncher.mjs");
|
||||||
if (process.platform === "win32")
|
if (platform !== "linux")
|
||||||
return {
|
return {
|
||||||
HOPPER_LAUNCHER_PATH: process.execPath,
|
HOPPER_LAUNCHER_PATH: process.execPath,
|
||||||
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fakeLauncher]),
|
HOPPER_LOADER_ARGS_JSON: JSON.stringify([fakeLauncher]),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { readFile } from "node:fs/promises";
|
import { readFile } from "node:fs/promises";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { packageHopperEnvironment } from "../scripts/verify-package-environment.mjs";
|
||||||
|
|
||||||
describe("package installation workflows", () => {
|
describe("package installation workflows", () => {
|
||||||
it("runs package E2E without the retired native rebuild script", async () => {
|
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('mkdtemp(join(tmpdir(), "rea-published-canary-")');
|
||||||
expect(canary).toContain("cwd: canaryRoot");
|
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`,
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user