hermes-agent/apps/desktop/electron/dock-launch-order.test.ts
brooklyn! e726b79803 fix(desktop): stop macOS launch from showing two Dock icons
The setup launcher had no LSUIElement, and its already-installed hand-off
ran after Tauri/AppKit, whose default activation policy is Regular. That
registered the setup bundle as a second Dock app beside the real desktop.
Hand off before constructing Tauri, and restore Regular activation only
when the installer UI is actually shown.

On macOS the Electron single-instance lock also ran before deep-link
registration. setAsDefaultProtocolClient relaunches the app through Launch
Services, so the loser already had a Dock icon by the time the lock failed
and app.exit(0) ran. Register the protocol first. The lock-losing instance
still hard-exits before ready.

Fixes #73151
2026-09-25 01:01:42 -05:00

17 lines
774 B
TypeScript

import { describe, expect, it } from 'vitest'
import { deepLinkRegistersBeforeSingleInstanceLock, preReadyDockLaunchSteps } from './dock-launch-order'
describe('macOS Dock launch order', () => {
it('registers the deep link before the single-instance lock', () => {
expect(preReadyDockLaunchSteps('darwin')).toEqual(['register-deep-link', 'single-instance-lock'])
expect(deepLinkRegistersBeforeSingleInstanceLock('darwin')).toBe(true)
})
it('keeps non-macOS platforms on the lock at module load, with no Dock race', () => {
for (const platform of ['win32', 'linux', 'freebsd']) {
expect(preReadyDockLaunchSteps(platform)).toEqual(['single-instance-lock'])
expect(deepLinkRegistersBeforeSingleInstanceLock(platform)).toBe(false)
}
})
})