From 03d04c243b86629166386e73ee657ca38c0e42ce Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 4 May 2026 04:20:30 -0700 Subject: [PATCH] test(acpx): cover Windows extension test paths --- extensions/acpx/src/codex-auth-bridge.test.ts | 19 +++++++++++++------ extensions/acpx/src/config.test.ts | 2 +- test/vitest/vitest.shared.config.ts | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/extensions/acpx/src/codex-auth-bridge.test.ts b/extensions/acpx/src/codex-auth-bridge.test.ts index 1c44612e875..051c493647b 100644 --- a/extensions/acpx/src/codex-auth-bridge.test.ts +++ b/extensions/acpx/src/codex-auth-bridge.test.ts @@ -56,13 +56,20 @@ function generatedClaudePaths(stateDir: string): { } function expectCodexWrapperCommand(command: string | undefined, wrapperPath: string): void { - expect(command).toContain(process.execPath); - expect(command).toContain(wrapperPath); + expect(command).toContain(quoteArg(process.execPath)); + expect(command).toContain(quoteArg(wrapperPath)); } function expectClaudeWrapperCommand(command: string | undefined, wrapperPath: string): void { - expect(command).toContain(process.execPath); - expect(command).toContain(wrapperPath); + expect(command).toContain(quoteArg(process.execPath)); + expect(command).toContain(quoteArg(wrapperPath)); +} + +function expectWrapperToContainPathSuffix(wrapper: string, pathSuffix: string[]): void { + const nativeSuffix = pathSuffix.join(path.sep); + const escapedNativeSuffix = JSON.stringify(nativeSuffix).slice(1, -1); + const posixSuffix = pathSuffix.join("/"); + expect(wrapper.includes(escapedNativeSuffix) || wrapper.includes(posixSuffix)).toBe(true); } afterEach(async () => { @@ -199,7 +206,7 @@ describe("prepareAcpxCodexAuthConfig", () => { const wrapper = await fs.readFile(generated.wrapperPath, "utf8"); expect(wrapper).toContain("@zed-industries/codex-acp"); - expect(wrapper).toContain("bin/codex-acp.js"); + expectWrapperToContainPathSuffix(wrapper, ["bin", "codex-acp.js"]); expect(wrapper).toContain("defaultArgs = [installedBinPath]"); }); @@ -219,7 +226,7 @@ describe("prepareAcpxCodexAuthConfig", () => { const wrapper = await fs.readFile(generated.wrapperPath, "utf8"); expect(wrapper).toContain("@agentclientprotocol/claude-agent-acp"); - expect(wrapper).toContain("dist/index.js"); + expectWrapperToContainPathSuffix(wrapper, ["dist", "index.js"]); expect(wrapper).toContain("defaultArgs = [installedBinPath]"); }); diff --git a/extensions/acpx/src/config.test.ts b/extensions/acpx/src/config.test.ts index fec4b6934b3..bf451d52fe0 100644 --- a/extensions/acpx/src/config.test.ts +++ b/extensions/acpx/src/config.test.ts @@ -5,7 +5,7 @@ import { resolveAcpxPluginConfig, resolveAcpxPluginRoot } from "./config.js"; describe("embedded acpx plugin config", () => { it("resolves workspace stateDir and cwd by default", () => { - const workspaceDir = "/tmp/openclaw-acpx"; + const workspaceDir = path.resolve("/tmp/openclaw-acpx"); const resolved = resolveAcpxPluginConfig({ rawConfig: undefined, workspaceDir, diff --git a/test/vitest/vitest.shared.config.ts b/test/vitest/vitest.shared.config.ts index 2490008bc30..7256b692c16 100644 --- a/test/vitest/vitest.shared.config.ts +++ b/test/vitest/vitest.shared.config.ts @@ -303,6 +303,7 @@ export const sharedVitestConfig = { "**/node_modules/**", "**/vendor/**", "dist/OpenClaw.app/**", + "**/._*", "**/*.live.test.ts", "**/*.e2e.test.ts", ],