diff --git a/src/memory/qmd-manager.test.ts b/src/memory/qmd-manager.test.ts index 4825344d3..717257a5b 100644 --- a/src/memory/qmd-manager.test.ts +++ b/src/memory/qmd-manager.test.ts @@ -886,7 +886,7 @@ describe("QmdMemoryManager", () => { await manager.close(); }); - it("uses qmd.cmd on Windows when qmd command is bare", async () => { + it("resolves bare qmd command to a Windows-compatible spawn invocation", async () => { const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32"); try { const { manager } = await createManager({ mode: "status" }); @@ -894,13 +894,23 @@ describe("QmdMemoryManager", () => { const qmdCalls = spawnMock.mock.calls.filter((call: unknown[]) => { const args = call[1] as string[] | undefined; - return Array.isArray(args) && args.length > 0; + return ( + Array.isArray(args) && + args.some((token) => token === "update" || token === "search" || token === "query") + ); }); expect(qmdCalls.length).toBeGreaterThan(0); for (const call of qmdCalls) { - expect(call[0]).toBe("qmd.cmd"); + const command = String(call[0]); const options = call[2] as { shell?: boolean } | undefined; - expect(options?.shell).toBe(true); + if (/(^|[\\/])qmd(?:\.cmd)?$/i.test(command)) { + // Wrapper unresolved: keep `.cmd` and use shell for PATHEXT lookup. + expect(command.toLowerCase().endsWith("qmd.cmd")).toBe(true); + expect(options?.shell).toBe(true); + } else { + // Wrapper resolved to node/exe entrypoint: shell fallback should not be used. + expect(options?.shell).not.toBe(true); + } } await manager.close();