test(claude): wait for the child to record the frame, not just for its report

The scripted CLI writes its report at startup, so `until(readReport)` returned a
report with no user messages whenever the child had not yet read the line. The
assertion then failed under parallel load. Poll for the frame instead of for the
file.

Claude-Session: https://claude.ai/code/session_01AobxxokqQ3qcxS7sy7ckum
This commit is contained in:
Merge Sim
2026-09-01 22:31:30 -07:00
parent 7cbfd4c946
commit 64e632092e
@@ -187,7 +187,13 @@ describe('Claude stream-json connection', () => {
parent_tool_use_id: null,
session_id: SESSION_ID
})
const report = await until(() => readReportSafely(scenario), 'the scripted CLI report')
// The report exists from the child's first line of work, so poll for the frame
// itself: `send` settles on the SDK's completed write, and the child still has
// to read that line before it can record it.
const report = await until(
() => (readReportSafely(scenario)?.userMessages.length ? readReportSafely(scenario) : null),
'the user frame recorded by the child'
)
expect(report.userMessages).toHaveLength(1)
await until(() => messages.find((message) => message.uuid === 'uuid-replay-1'), 'the replay')