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

@@ -7,15 +7,15 @@ afterEach(() => {
});
describe("DEFAULT_AGENT_WORKSPACE_DIR", () => {
// Unix-style paths behave differently on Windows; skip there
it.skipIf(process.platform === "win32")("uses OPENCLAW_HOME at module import time", async () => {
vi.stubEnv("OPENCLAW_HOME", "/srv/openclaw-home");
vi.stubEnv("HOME", "/home/other");
it("uses OPENCLAW_HOME at module import time", async () => {
const home = path.join(path.sep, "srv", "openclaw-home");
vi.stubEnv("OPENCLAW_HOME", home);
vi.stubEnv("HOME", path.join(path.sep, "home", "other"));
vi.resetModules();
const mod = await import("./workspace.js");
expect(mod.DEFAULT_AGENT_WORKSPACE_DIR).toBe(
path.join(path.resolve("/srv/openclaw-home"), ".openclaw", "workspace"),
path.join(path.resolve(home), ".openclaw", "workspace"),
);
});
});