MCPcopy
hub / github.com/marktext/marktext / installRendererErrorCounter

Function installRendererErrorCounter

packages/desktop/test/e2e/helpers.ts:97–110  ·  view source on GitHub ↗
(app: ElectronApplication)

Source from the content-addressed store, hash-verified

95// accumulate the count in a shared global so specs can read it back via
96// `getRendererErrors`. Multiple listeners are allowed on ipcMain.
97const 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
112export const getRendererErrors = async(
113 app: ElectronApplication

Callers 1

launchElectronFunction · 0.85

Calls 2

pushMethod · 0.80
onMethod · 0.65

Tested by

no test coverage detected