Skip to content

Commit 605bf22

Browse files
authored
fix(browser): fail the run when a tester cannot connect (#11802)
1 parent 4277075 commit 605bf22

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎packages/browser/src/client/orchestrator.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,11 @@ export class IframeOrchestrator {
601601
}
602602
if (e.data.event === `response:${event.event}`) {
603603
cleanupEvents()
604-
resolve()
604+
if (e.data.error) {
605+
reject(new Error(e.data.error))
606+
} else {
607+
resolve()
608+
}
605609
}
606610
}
607611

‎packages/browser/src/client/tester/tester.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,19 @@ channel.addEventListener('message', async (e) => {
6868
messageId: data.messageId,
6969
})
7070

71-
await client.waitForConnection()
71+
try {
72+
await client.waitForConnection()
73+
} catch (error: any) {
74+
// the tester cannot report the error over its own connection,
75+
// so pass it to the orchestrator instead of leaving it waiting
76+
channel.postMessage({
77+
event: `response:${data.event}`,
78+
iframeId: data.iframeId,
79+
messageId: data.messageId,
80+
error: error.message,
81+
})
82+
return
83+
}
7284
debug?.('event from orchestrator', JSON.stringify(e.data))
7385

7486
try {

0 commit comments

Comments
 (0)