Skip to content

Commit a66d8ff

Browse files
committed
test: cover CLI spawn cleanup
1 parent ef8fd8f commit a66d8ff

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎src/agents/cli-runner.spawn.test.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ import { setCliRunnerPrepareTestDeps } from "./cli-runner/prepare.js";
3535
import type { PreparedCliRunContext } from "./cli-runner/types.js";
3636
import { createClaudeApiErrorFixture } from "./test-helpers/claude-api-error-fixture.js";
3737

38+
vi.mock("../plugin-sdk/anthropic-cli.js", () => ({
39+
CLAUDE_CLI_BACKEND_ID: "claude-cli",
40+
isClaudeCliProvider: (providerId: string) => providerId === "claude-cli",
41+
}));
42+
3843
type ProcessSupervisor = ReturnType<typeof getProcessSupervisor>;
3944
type SupervisorSpawnFn = ProcessSupervisor["spawn"];
4045

@@ -491,10 +496,13 @@ describe("runCliAgent spawn path", () => {
491496
},
492497
}),
493498
);
494-
await expect(fs.access(pluginDir)).rejects.toSatisfy((error) => {
495-
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
496-
return true;
497-
});
499+
let accessError: unknown;
500+
try {
501+
await fs.access(pluginDir);
502+
} catch (error) {
503+
accessError = error;
504+
}
505+
expect((accessError as NodeJS.ErrnoException | undefined)?.code).toBe("ENOENT");
498506
} finally {
499507
await fs.rm(workspaceDir, { recursive: true, force: true });
500508
}

0 commit comments

Comments
 (0)