test: normalize paths in OPENCLAW_HOME tests for cross-platform support (#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
This commit is contained in:
max
2026-02-08 17:21:31 -08:00
committed by GitHub
parent 456bd58740
commit 53a1ac36f5
4 changed files with 67 additions and 77 deletions

View File

@@ -208,22 +208,21 @@ describe("resolveAgentConfig", () => {
expect(result?.workspace).toBe("~/openclaw");
});
// Unix-style paths behave differently on Windows; skip there
it.skipIf(process.platform === "win32")("uses OPENCLAW_HOME for default agent workspace", () => {
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
it("uses OPENCLAW_HOME for default agent workspace", () => {
const home = path.join(path.sep, "srv", "openclaw-home");
vi.stubEnv("OPENCLAW_HOME", home);
const workspace = resolveAgentWorkspaceDir({} as OpenClawConfig, "main");
expect(workspace).toBe(path.join(path.resolve("/srv/openclaw-home"), ".openclaw", "workspace"));
expect(workspace).toBe(path.join(path.resolve(home), ".openclaw", "workspace"));
});
// Unix-style paths behave differently on Windows; skip there
it.skipIf(process.platform === "win32")("uses OPENCLAW_HOME for default agentDir", () => {
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
it("uses OPENCLAW_HOME for default agentDir", () => {
const home = path.join(path.sep, "srv", "openclaw-home");
vi.stubEnv("OPENCLAW_HOME", home);
// Clear state dir so it falls back to OPENCLAW_HOME
vi.stubEnv("OPENCLAW_STATE_DIR", "");
const agentDir = resolveAgentDir({} as OpenClawConfig, "main");
expect(agentDir).toBe(
path.join(path.resolve("/srv/openclaw-home"), ".openclaw", "agents", "main", "agent"),
);
expect(agentDir).toBe(path.join(path.resolve(home), ".openclaw", "agents", "main", "agent"));
});
});