Skip to content

Commit f6d0f5a

Browse files
committed
fix: handle platform-specific command wrapping in Windows test
1 parent 15216b2 commit f6d0f5a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/services/mcp/__tests__/McpHub.spec.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,18 @@ describe("McpHub", () => {
643643

644644
// Verify that only the enabled server was connected
645645
expect(StdioClientTransport).toHaveBeenCalledTimes(1)
646-
expect(StdioClientTransport).toHaveBeenCalledWith(
647-
expect.objectContaining({
648-
args: ["test2.js"], // Only the enabled server
649-
}),
650-
)
646+
647+
// Check the call arguments - handle Windows cmd.exe wrapping
648+
const callArgs = StdioClientTransport.mock.calls[0][0]
649+
if (process.platform === "win32") {
650+
// On Windows, commands are wrapped with cmd.exe
651+
expect(callArgs.command).toBe("cmd.exe")
652+
expect(callArgs.args).toEqual(["/c", "node", "test2.js"])
653+
} else {
654+
// On other platforms, no wrapping
655+
expect(callArgs.command).toBe("node")
656+
expect(callArgs.args).toEqual(["test2.js"])
657+
}
651658
})
652659

653660
it("should disconnect server when toggling to disabled", async () => {

0 commit comments

Comments
 (0)