import type { GoTestPlan } from "./plan-go-test-from-slash-args.ts"; import type { CommandExecutor } from "../ports/command-executor.ts"; export type ExecuteTestRunPlanInput = { executor: CommandExecutor; timeoutMs?: number; signal?: AbortSignal; }; export type TestRunExecutionResult = { ok: boolean; displayCommand: string; stdout: string; stderr: string; exitCode: number; killed: boolean; }; export async function executeTestRunPlan( plan: GoTestPlan, input: ExecuteTestRunPlanInput, ): Promise { const result = await input.executor.exec(plan.command, plan.args, { cwd: plan.cwd, timeoutMs: input.timeoutMs, signal: input.signal, }); return { ok: result.code === 0 && !result.killed, displayCommand: plan.displayCommand, stdout: result.stdout, stderr: result.stderr, exitCode: result.code, killed: result.killed, }; }