Add back testUtilities.debug

This commit is contained in:
trevor-signal 2024-07-02 15:56:40 -04:00 committed by GitHub
parent 3ff9b87a22
commit 0ab8ec34d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View file

@ -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`,

View file

@ -123,6 +123,14 @@ async function launchElectron(attempt: number): Promise<void> {
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;
}

1
ts/window.d.ts vendored
View file

@ -281,6 +281,7 @@ declare global {
assert: typeof assert;
testUtilities: {
setup: MochaOptions;
debug: (info: unknown) => void;
onTestEvent: (event: unknown) => void;
initialize: () => Promise<void>;
prepareTests: () => void;

View file

@ -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();