Skip to content

Commit cccb2a5

Browse files
byapparovclaude
andcommitted
test(run): group the throwing-handler test with the #223 suite (#224 review)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015nwvfUHdM3bgMgD9Zpz7Mj
1 parent 54bb214 commit cccb2a5

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎packages/cli/test/cli/run-user-message.test.ts‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,12 @@ describe("run --format json user_message (#223)", () => {
232232
const sequence = result.events.filter((event) => event.sequenceNum !== undefined).map((event) => event.sequenceNum)
233233
expect(sequence).toEqual(sequence.map((_, index) => index + 1))
234234
}, 25_000)
235-
})
236235

237-
const source = (file: string) => JSON.stringify(path.resolve(import.meta.dir, "../../src", file))
236+
const source = (file: string) => JSON.stringify(path.resolve(import.meta.dir, "../../src", file))
238237

239-
// The prompt stores a user message, then a child-session permission request makes the
240-
// event handler throw before any later primary-session event could complete the message.
241-
const throwingHandler = `import { SessionPrompt } from ${source("session/prompt.ts")}
238+
// The prompt stores a user message, then a child-session permission request makes the
239+
// event handler throw before any later primary-session event could complete the message.
240+
const throwingHandler = `import { SessionPrompt } from ${source("session/prompt.ts")}
242241
import { PermissionNext } from ${source("permission/next.ts")}
243242
import { GlobalBus } from ${source("bus/global.ts")}
244243
const publish = (type, properties) => GlobalBus.emit("event", { payload: { type, properties } })
@@ -258,16 +257,17 @@ SessionPrompt.prompt = async ({ sessionID }) => {
258257
}
259258
`
260259

261-
test("a pending user message is emitted when an event handler throws", async () => {
262-
const result = await run({ args: ["Hello"], preload: throwingHandler })
263-
expect(result.exit).toBe(1)
264-
expect(result.stderr).toContain("Fixture handler failure")
265-
expect(userMessageEvents(result.events)).toMatchObject([
266-
{ messageID: "msg_user", parts: [{ id: "prt_user", text: "Hello" }], sequenceNum: 1 },
267-
])
268-
const types = result.events.map((event) => event.type)
269-
expect(types.indexOf("user_message")).toBeLessThan(types.indexOf("session_error"))
270-
}, 25_000)
260+
test("a pending user message is emitted when an event handler throws", async () => {
261+
const result = await run({ args: ["Hello"], preload: throwingHandler })
262+
expect(result.exit).toBe(1)
263+
expect(result.stderr).toContain("Fixture handler failure")
264+
expect(userMessageEvents(result.events)).toMatchObject([
265+
{ messageID: "msg_user", parts: [{ id: "prt_user", text: "Hello" }], sequenceNum: 1 },
266+
])
267+
const types = result.events.map((event) => event.type)
268+
expect(types.indexOf("user_message")).toBeLessThan(types.indexOf("session_error"))
269+
}, 25_000)
270+
})
271271

272272
describe("userMessages", () => {
273273
const sessionID = "ses_primary"

0 commit comments

Comments
 (0)