From 8849319e8bdaffa6303c26bd268d77f62adb5c54 Mon Sep 17 00:00:00 2001 From: Jack Wotherspoon Date: Mon, 9 Mar 2026 15:17:34 +0100 Subject: [PATCH] chore: update test --- packages/cli/src/utils/processUtils.test.ts | 18 +++++++++++++----- packages/cli/src/utils/processUtils.ts | 11 ++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/utils/processUtils.test.ts b/packages/cli/src/utils/processUtils.test.ts index 487c702dc5..9498d94b96 100644 --- a/packages/cli/src/utils/processUtils.test.ts +++ b/packages/cli/src/utils/processUtils.test.ts @@ -26,7 +26,12 @@ describe('processUtils', () => { beforeEach(() => { _resetRelaunchStateForTesting(); - process.send = vi.fn(); + process.send = vi.fn( + (_msg: unknown, callback?: (err: Error | null) => void) => { + if (callback) callback(null); + return true; + }, + ); }); afterEach(() => { @@ -46,10 +51,13 @@ describe('processUtils', () => { await relaunchApp('custom-session-id'); expect(handleAutoUpdate.waitForUpdateCompletion).toHaveBeenCalledTimes(1); expect(runExitCleanup).toHaveBeenCalledTimes(1); - expect(process.send).toHaveBeenCalledWith({ - type: 'relaunch-session', - sessionId: 'custom-session-id', - }); + expect(process.send).toHaveBeenCalledWith( + { + type: 'relaunch-session', + sessionId: 'custom-session-id', + }, + expect.any(Function), + ); expect(processExit).toHaveBeenCalledWith(RELAUNCH_EXIT_CODE); }); }); diff --git a/packages/cli/src/utils/processUtils.ts b/packages/cli/src/utils/processUtils.ts index 9ebb5c2730..5a09c2bb47 100644 --- a/packages/cli/src/utils/processUtils.ts +++ b/packages/cli/src/utils/processUtils.ts @@ -29,9 +29,14 @@ export async function relaunchApp(sessionId?: string): Promise { await runExitCleanup(); if (process.send && sessionId) { - process.send({ - type: 'relaunch-session', - sessionId, + await new Promise((resolve) => { + process.send!( + { + type: 'relaunch-session', + sessionId, + }, + () => resolve(), + ); }); }