Skip to content

armgit / rea

Public Imported from GitHub
0

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

test: resolve script paths from file URLs with fileURLToPath on Windows (#3266)

pablodiazjorgef8f3593a8c8c
diff --git a/tests/boundary/evm/solidityMetadataWorker.test.ts b/tests/boundary/evm/solidityMetadataWorker.test.ts
index 0577983c4..df72002b5 100644
--- a/tests/boundary/evm/solidityMetadataWorker.test.ts
+++ b/tests/boundary/evm/solidityMetadataWorker.test.ts
@@ -1,6 +1,7 @@
import { execFile } from "node:child_process";
import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
+import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
import { expect, it } from "vitest";
import { solidityMetadataSchema } from "../../../src/domain/evm/solidityMetadata.js";
@@ -38,8 +39,12 @@ it.each([
[
"--max-old-space-size=256",
"--disable-wasm-trap-handler",
- new URL("../../../dist/evm/EvmoleInterfaceWorker.js", import.meta.url)
- .pathname,
+ fileURLToPath(
+ new URL(
+ "../../../dist/evm/EvmoleInterfaceWorker.js",
+ import.meta.url,
+ ),
+ ),
request,
],
{ timeout: 30_000, maxBuffer: 1024 * 1024 },
diff --git a/tests/boundary/filesystem/ciChangeScope.test.ts b/tests/boundary/filesystem/ciChangeScope.test.ts
index 13625bc17..e56c894ba 100644
--- a/tests/boundary/filesystem/ciChangeScope.test.ts
+++ b/tests/boundary/filesystem/ciChangeScope.test.ts
@@ -416,7 +416,10 @@ it.each(["", "not-a-commit"])(
},
);
-it("selects only a trusted successful ancestor from recent CI push runs", async () => {
+it("selects only a trusted successful ancestor from recent CI push runs", async ({
+ skip,
+}) => {
+ skip(process.platform === "win32", "the fake gh is a POSIX shell script");
const { directory, base } = await fixture();
const head = await change(directory, ["src/evm/client.ts"]);
const bin = join(directory, "fake-bin");
@@ -449,7 +452,11 @@ it("selects only a trusted successful ancestor from recent CI push runs", async
const output = join(directory, "baseline-output");
const result = await execFileAsync(
process.execPath,
- [new URL("../../../scripts/ci/baseline.mjs", import.meta.url).pathname],
+ [
+ fileURLToPath(
+ new URL("../../../scripts/ci/baseline.mjs", import.meta.url),
+ ),
+ ],
{
cwd: directory,
env: {
@@ -467,7 +474,8 @@ it("selects only a trusted successful ancestor from recent CI push runs", async
expect(await readFile(output, "utf8")).toBe(`base=${base}\nreason=\n`);
});
-it("returns an empty baseline when GitHub lookup fails", async () => {
+it("returns an empty baseline when GitHub lookup fails", async ({ skip }) => {
+ skip(process.platform === "win32", "the fake gh is a POSIX shell script");
const { directory, base } = await fixture();
const head = await change(directory, ["src/evm/client.ts"]);
const bin = join(directory, "fake-bin");
@@ -477,7 +485,11 @@ it("returns an empty baseline when GitHub lookup fails", async () => {
await chmod(gh, 0o755);
const result = await execFileAsync(
process.execPath,
- [new URL("../../../scripts/ci/baseline.mjs", import.meta.url).pathname],
+ [
+ fileURLToPath(
+ new URL("../../../scripts/ci/baseline.mjs", import.meta.url),
+ ),
+ ],
{
cwd: directory,
env: {
diff --git a/tests/boundary/filesystem/releaseWorkflow.test.ts b/tests/boundary/filesystem/releaseWorkflow.test.ts
index 712ed8945..8dac94339 100644
--- a/tests/boundary/filesystem/releaseWorkflow.test.ts
+++ b/tests/boundary/filesystem/releaseWorkflow.test.ts
@@ -1,6 +1,7 @@
import { execFile } from "node:child_process";
import { readFile, writeFile } from "node:fs/promises";
import { delimiter, join } from "node:path";
+import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
import { expect, it } from "vitest";
import { parse } from "yaml";
@@ -348,7 +349,7 @@ it("binds npm and MCP publication to the same immutable release SHA", async () =
import.meta.url,
);
const result = await execFileAsync(process.execPath, [
- helper.pathname,
+ fileURLToPath(helper),
version,
]);
expect(result.stdout).toBe(tag);
diff --git a/tests/boundary/providers/hopper/hopperBridgeFacade.test.ts b/tests/boundary/providers/hopper/hopperBridgeFacade.test.ts
index a4be45673..f47f579fa 100644
--- a/tests/boundary/providers/hopper/hopperBridgeFacade.test.ts
+++ b/tests/boundary/providers/hopper/hopperBridgeFacade.test.ts
@@ -1,4 +1,5 @@
import { execFile } from "node:child_process";
+import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
import { describe, expect, it } from "vitest";
@@ -133,7 +134,7 @@ describe("Hopper API facade", () => {
it("imports without Hopper globals and gates exhaustive work during analysis", async () => {
const { stdout } = await execute(
"python3",
- [probePath.pathname, bridgePath.pathname],
+ [fileURLToPath(probePath), fileURLToPath(bridgePath)],
{
encoding: "utf8",
timeout: 3_000,