(app: ElectronApplication)
| 95 | // accumulate the count in a shared global so specs can read it back via |
| 96 | // `getRendererErrors`. Multiple listeners are allowed on ipcMain. |
| 97 | const installRendererErrorCounter = async(app: ElectronApplication): Promise<void> => { |
| 98 | await app.evaluate(({ ipcMain }) => { |
| 99 | const g = global as unknown as { |
| 100 | __mt_renderer_errors__?: Array<{ message?: string; name?: string; stack?: string }> |
| 101 | } |
| 102 | if (!g.__mt_renderer_errors__) { |
| 103 | const sink: Array<{ message?: string; name?: string; stack?: string }> = [] |
| 104 | g.__mt_renderer_errors__ = sink |
| 105 | ipcMain.on('mt::handle-renderer-error', (_e, error) => { |
| 106 | sink.push(error) |
| 107 | }) |
| 108 | } |
| 109 | }) |
| 110 | } |
| 111 | |
| 112 | export const getRendererErrors = async( |
| 113 | app: ElectronApplication |
no test coverage detected