From 0ab8ec34d0c32197436aff4b339db22160981e75 Mon Sep 17 00:00:00 2001 From: trevor-signal <131492920+trevor-signal@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:56:40 -0400 Subject: [PATCH] Add back testUtilities.debug --- app/main.ts | 4 ++++ ts/scripts/test-electron.ts | 8 ++++++++ ts/window.d.ts | 1 + ts/windows/main/preload_test.ts | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/app/main.ts b/app/main.ts index a6d6d166ed12..9f7ee9fd8da2 100644 --- a/app/main.ts +++ b/app/main.ts @@ -2977,6 +2977,10 @@ if (isTestEnvironment(getEnvironment())) { event.returnValue = process.argv; }); + ipc.handle('ci:test-electron:debug', async (_event, info) => { + process.stdout.write(`ci:test-electron:debug=${JSON.stringify(info)}\n`); + }); + ipc.handle('ci:test-electron:event', async (_event, event) => { process.stdout.write( `ci:test-electron:event=${JSON.stringify(event)}\n`, diff --git a/ts/scripts/test-electron.ts b/ts/scripts/test-electron.ts index d2c41b833181..fe9fc9036bcc 100644 --- a/ts/scripts/test-electron.ts +++ b/ts/scripts/test-electron.ts @@ -123,6 +123,14 @@ async function launchElectron(attempt: number): Promise { const match = line.match(/^ci:test-electron:event=(.*)/); if (!match) { + const debugMatch = line.match(/ci:test-electron:debug=(.*)?/); + if (debugMatch) { + try { + console.log('DEBUG:', JSON.parse(debugMatch[1])); + } catch { + // pass + } + } return; } diff --git a/ts/window.d.ts b/ts/window.d.ts index 88f34f46bd61..fbb0258e9739 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -281,6 +281,7 @@ declare global { assert: typeof assert; testUtilities: { setup: MochaOptions; + debug: (info: unknown) => void; onTestEvent: (event: unknown) => void; initialize: () => Promise; prepareTests: () => void; diff --git a/ts/windows/main/preload_test.ts b/ts/windows/main/preload_test.ts index c4035d4f8aa4..58c32f4f894a 100644 --- a/ts/windows/main/preload_test.ts +++ b/ts/windows/main/preload_test.ts @@ -71,6 +71,10 @@ window.testUtilities = { return ipc.invoke('ci:test-electron:event', event); }, + debug(info) { + return ipc.invoke('ci:test-electron:debug', info); + }, + async initialize() { initMessageCleanup(); await initializeMessageCounter();