mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
test(infra): run Windows path regressions cross-platform (#116627)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { withMockedPlatform } from "../test-utils/vitest-spies.js";
|
||||
import { makeExecutable, makePathEnv, makeTempDir } from "./exec-approvals-test-helpers.js";
|
||||
import {
|
||||
evaluateExecAllowlist,
|
||||
@@ -562,27 +563,25 @@ describe("exec-command-resolution", () => {
|
||||
});
|
||||
|
||||
it("does not synthesize cwd-joined allowlist candidates from drive-less windows roots", () => {
|
||||
if (process.platform !== "win32") {
|
||||
return;
|
||||
}
|
||||
|
||||
expect(
|
||||
resolveAllowlistCandidatePath(
|
||||
{
|
||||
rawExecutable: String.raw`:\Users\demo\AI\system\openclaw`,
|
||||
executableName: "openclaw",
|
||||
},
|
||||
String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
resolveAllowlistCandidatePath(
|
||||
{
|
||||
rawExecutable: String.raw`:/Users/demo/AI/system/openclaw`,
|
||||
executableName: "openclaw",
|
||||
},
|
||||
String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
),
|
||||
).toBeUndefined();
|
||||
withMockedPlatform("win32", () => {
|
||||
expect(
|
||||
resolveAllowlistCandidatePath(
|
||||
{
|
||||
rawExecutable: String.raw`:\Users\demo\AI\system\openclaw`,
|
||||
executableName: "openclaw",
|
||||
},
|
||||
String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
resolveAllowlistCandidatePath(
|
||||
{
|
||||
rawExecutable: String.raw`:/Users/demo/AI/system/openclaw`,
|
||||
executableName: "openclaw",
|
||||
},
|
||||
String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -195,20 +195,18 @@ describe("executable path helpers", () => {
|
||||
);
|
||||
|
||||
it("does not treat drive-less rooted windows paths as cwd-relative executables", () => {
|
||||
if (process.platform !== "win32") {
|
||||
return;
|
||||
}
|
||||
|
||||
expect(
|
||||
resolveExecutablePath(String.raw`:\Users\demo\AI\system\openclaw\git.exe`, {
|
||||
cwd: String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
resolveExecutablePath(String.raw`:/Users/demo/AI/system/openclaw/git.exe`, {
|
||||
cwd: String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
withMockedPlatform("win32", () => {
|
||||
expect(
|
||||
resolveExecutablePath(String.raw`:\Users\demo\AI\system\openclaw\git.exe`, {
|
||||
cwd: String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
resolveExecutablePath(String.raw`:/Users/demo/AI/system/openclaw/git.exe`, {
|
||||
cwd: String.raw`C:\Users\demo\AI\system\openclaw`,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user