mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
test: resolve script paths from file URLs with fileURLToPath on Windows (#3266)
* test: resolve worker and CI script paths with fileURLToPath on Windows * test: skip the fake gh lookup failure on Windows * test: resolve the release helper and Hopper probe paths with fileURLToPath
This commit is contained in:
@@ -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 },
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user