Skip to content

Commit 3a072f2

Browse files
committed
Throw error if Codex binary is missing during test fixture creation
1 parent aa74e7d commit 3a072f2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/__tests__/acp-test-utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {startCodexConnection} from "../CodexJsonRpcConnection";
44
import {CodexAcpServer} from "../CodexAcpServer";
55
import type {AgentSideConnection} from "@agentclientprotocol/sdk";
66
import path from "node:path";
7+
import fs from "node:fs";
78

89
export type MethodCallEvent = { method: string; args: any[] };
910

@@ -34,6 +35,10 @@ export interface TestFixture {
3435

3536
export function createTestFixture(): TestFixture {
3637
const pathToCodex = path.resolve(process.cwd(), "node_modules", ".bin", process.platform === 'win32' ? "codex.cmd" : "codex");
38+
if (!fs.existsSync(pathToCodex)) {
39+
throw new Error(`Codex binary not found at ${pathToCodex}. Did you run 'npm install'?`);
40+
}
41+
3742
const acpConnectionEvents: MethodCallEvent[] = []
3843
const acpEventHandlers: ((event: MethodCallEvent) => void)[] = [];
3944
const acpConnection = createSmartMock<AgentSideConnection>((event) => {

0 commit comments

Comments
 (0)