Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions e2e/create-expert/create-expert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ function getAllCalledToolNames(result: RunResult): string[] {
)
}

/** Build a diagnostic string from RunResult for assertion failure messages */
function diagnostics(result: RunResult): string {
const errorEvents = result.events
.filter((e) => e.type === "stopRunByError")
.map((e) => {
const err = (e as { error?: { name: string; message: string } }).error
return err ? `${err.name}: ${err.message}` : "unknown error"
})
const parts = [`exitCode=${result.exitCode}`]
if (result.stderr) parts.push(`stderr=${result.stderr.slice(0, 500)}`)
if (errorEvents.length > 0) parts.push(`errors=[${errorEvents.join(", ")}]`)
return parts.join("\n")
}

describe("create-expert", () => {
it(
"should create a new perstack.toml",
Expand All @@ -77,7 +91,7 @@ describe("create-expert", () => {
tempDir,
)

expect(result.exitCode).toBe(0)
expect(result.exitCode, diagnostics(result)).toBe(0)

// Verify control flow: coordinator starts, delegates, then completes
const controlFlow = result.events
Expand Down Expand Up @@ -143,7 +157,7 @@ pick = ["attemptCompletion"]

const result = await runCreateExpert("Add a testing expert that runs unit tests", tempDir)

expect(result.exitCode).toBe(0)
expect(result.exitCode, diagnostics(result)).toBe(0)

// Verify control flow: start → delegate → complete
expect(
Expand Down