hermes-agent/apps/desktop/electron
David Metcalfe 31385a0102 test(desktop): cover find-in-page helpers and multi-window routing
Vitest coverage for apps/desktop/electron/find-in-page.ts.
The helpers and the IPC handlers in main.ts are the only
consumers, so the tests pin the wire shape (match counter
shape, options defaults, no-throw-on-destroyed) and the
multi-window correctness that the original CJS PR missed:

- formatFoundInPage:
  - Maps { activeMatchOrdinal, matches } → wire payload.
  - Coerces missing fields to zero (the renderer never
    sees NaN).
  - Tolerates null / undefined inputs.

- performFind:
  - Forwards query + options to webContents.findInPage.
  - Defaults forward=true and findNext=false when omitted.
  - Treats null / non-object options as "all defaults".
  - Coerces a non-string query to string (defensive against
    a misbehaving renderer).
  - Is a no-op on null webContents.
  - Is a no-op on destroyed webContents (does not throw
    across the IPC boundary).

- stopFind:
  - Calls stopFindInPage with the default action
    ('clearSelection').
  - Honors an explicit action argument.
  - Is a no-op on null or destroyed webContents.

- installFoundInPageForwarder:
  - Forwards 'found-in-page' to the sender as a formatted
    payload.
  - Handles missing fields without throwing.
  - Skips send when webContents is destroyed at fire time.
  - Returned uninstall removes the listener.
  - Returned uninstall on null/destroyed webContents is a
    safe no-op.
  - Regression: two forwarders installed on distinct
    webContents do not cross-fire. This is the bug the
    original PR shipped — the global mainWindow listener
    routed results to the primary regardless of which
    renderer invoked findInPage. Pinning this here keeps
    the per-sender routing from regressing.

Run with:
  cd apps/desktop && npx vitest run electron/find-in-page.test.ts --project electron
2026-07-26 17:48:05 -07:00
..
active-runtime-state.test.ts fix(desktop): launch a usable active runtime without a bootstrap marker 2026-07-26 16:12:14 -05:00
active-runtime-state.ts fix(desktop): launch a usable active runtime without a bootstrap marker 2026-07-26 16:12:14 -05:00
backend-child.ts test(desktop): extract hiddenWindowsChildOptions + stopBackendChild for real unit tests 2026-07-13 17:22:17 -04:00
backend-command.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
backend-command.ts cleanup(desktop): remove 'use strict' in ts & mjs 2026-07-13 17:22:17 -04:00
backend-connection-state.test.ts test(desktop): port backend-connection-state test to vitest 2026-07-16 14:55:58 -04:00
backend-connection-state.ts fix(desktop): ignore stale backend exits 2026-07-16 14:53:11 -04:00
backend-env.test.ts fmt(js): npm run fix on merge (#71099) 2026-07-25 00:35:03 +00:00
backend-env.ts fix(windows): platform._syscmd_ver stub in bootstrap + PYTHONUTF8 in desktop backend env 2026-07-24 15:47:12 -07:00
backend-health.test.ts fmt(js): npm run fix on merge (#71740) 2026-07-26 04:11:26 +00:00
backend-health.ts fix(desktop): read a readiness-probe 401 by whether it was credentialed 2026-07-25 21:52:26 -05:00
backend-probes.test.ts fmt(js): npm run fix on merge (#69805) 2026-07-23 03:32:32 +00:00
backend-probes.ts fix(desktop): skip bootstrap for explicit Nix backend (#69688) 2026-07-22 20:00:48 -04:00
backend-ready.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
backend-ready.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
backend-start-failure.test.ts fix(desktop): latch a confirmed remote reauth failure so the overlay stays clickable 2026-07-25 21:52:45 -05:00
backend-start-failure.ts fix(desktop): latch a confirmed remote reauth failure so the overlay stays clickable 2026-07-25 21:52:45 -05:00
bootstrap-platform.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
bootstrap-platform.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
bootstrap-runner.test.ts fmt(js): npm run fix on merge (#67749) 2026-07-19 23:42:14 +00:00
bootstrap-runner.ts fmt(js): npm run fix on merge (#67749) 2026-07-19 23:42:14 +00:00
connection-apply.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
connection-apply.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
connection-config.test.ts Merge remote-tracking branch 'origin/main' into feat/desktop-remote-ssh-current 2026-07-21 10:16:01 +02:00
connection-config.ts Merge remote-tracking branch 'origin/main' into feat/desktop-remote-ssh-current 2026-07-21 10:16:01 +02:00
dashboard-token.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
dashboard-token.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
desktop-electron-pin.test.ts fmt(js): npm run fix on merge (#65912) 2026-07-16 19:57:39 +00:00
desktop-installation.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
desktop-installation.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
desktop-uninstall.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
desktop-uninstall.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
embed-referer.ts feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
entitlements.mac.inherit.plist fix(desktop): inherit microphone entitlement for macOS helpers 2026-06-03 07:32:00 +07:00
entitlements.mac.plist Add Hermes desktop app (#20059) 2026-05-31 17:46:56 -05:00
event-dedupe.test.ts fix(desktop): de-dupe cross-window cues so peers don't spam 2026-07-20 18:33:14 -05:00
event-dedupe.ts refactor(desktop): tidy the cross-window deduper 2026-07-20 18:36:05 -05:00
find-git-bash.test.ts style(desktop): apply eslint/prettier conventions to find-git-bash module 2026-07-23 17:59:58 -07:00
find-git-bash.ts style(desktop): apply eslint/prettier conventions to find-git-bash module 2026-07-23 17:59:58 -07:00
find-in-page.test.ts test(desktop): cover find-in-page helpers and multi-window routing 2026-07-26 17:48:05 -07:00
find-in-page.ts feat(desktop): port find-in-page bridge to TypeScript Electron 2026-07-26 17:48:05 -07:00
first-run-setup-gate.test.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
first-run-setup-gate.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
first-run-setup-main-process.test.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
fs-read-dir.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
fs-read-dir.ts feat(desktop): bridge WSL paths for a Windows host + WSL backend 2026-07-12 05:32:54 -04:00
gateway-ws-probe.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
gateway-ws-probe.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
git-repo-scan.test.ts fmt(js): npm run fix on merge (#68681) 2026-07-21 14:28:28 +00:00
git-repo-scan.ts fmt(js): npm run fix on merge (#68681) 2026-07-21 14:28:28 +00:00
git-review-ops.test.ts fix(desktop): support spaced Windows Git paths in review 2026-07-19 12:22:23 -07:00
git-review-ops.ts fix(desktop): support spaced Windows Git paths in review 2026-07-19 12:22:23 -07:00
git-root.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
git-root.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
git-worktree-ops.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
git-worktree-ops.ts fmt(js): npm run fix on merge (#65912) 2026-07-16 19:57:39 +00:00
hardening.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
hardening.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
link-title-window.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
link-title-window.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
main-window-lifecycle.test.ts fmt(js): npm run fix on merge (#65912) 2026-07-16 19:57:39 +00:00
main-window-lifecycle.ts fix(desktop): restore closed main window on second launch (#64800) 2026-07-16 15:33:38 -04:00
main.ts feat(desktop): port find-in-page bridge to TypeScript Electron 2026-07-26 17:48:05 -07:00
native-auth-decisions.test.ts fix(desktop): name the readiness-probe auth and password-gateway guard decisions 2026-07-25 21:52:40 -05:00
native-auth-decisions.ts fix(desktop): name the readiness-probe auth and password-gateway guard decisions 2026-07-25 21:52:40 -05:00
native-oauth-login.test.ts fmt(js): npm run fix on merge (#69503) 2026-07-22 16:30:14 +00:00
native-oauth-login.ts fmt(js): npm run fix on merge (#69503) 2026-07-22 16:30:14 +00:00
native-oauth.test.ts fmt(js): npm run fix on merge (#69503) 2026-07-22 16:30:14 +00:00
native-oauth.ts fmt(js): npm run fix on merge (#69503) 2026-07-22 16:30:14 +00:00
oauth-net-request.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
oauth-net-request.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
power-save.test.ts feat(desktop): keep-computer-awake toggle + System settings section 2026-07-20 11:50:22 -05:00
power-save.ts feat(desktop): keep-computer-awake toggle + System settings section 2026-07-20 11:50:22 -05:00
preload.ts feat(desktop): port find-in-page bridge to TypeScript Electron 2026-07-26 17:48:05 -07:00
primary-backend-startup.test.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
primary-backend-startup.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
primary-connection-rehome.ts feat(desktop): add "Connect to existing Hermes" option to first-run onboarding 2026-07-24 12:55:06 -05:00
profile-delete-routing.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
profile-delete-routing.ts cleanup(desktop): remove 'use strict' in ts & mjs 2026-07-13 17:22:17 -04:00
remote-lifecycle.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
remote-lifecycle.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
remote-liveness.test.ts fix(desktop): avoid false remote gateway reauthentication (#68250) 2026-07-20 20:54:36 -04:00
remote-liveness.ts fix(desktop): avoid false remote gateway reauthentication (#68250) 2026-07-20 20:54:36 -04:00
session-windows.test.ts feat(desktop): open multiple full app windows (electron) 2026-07-20 18:02:44 -05:00
session-windows.ts feat(desktop): open multiple full app windows (electron) 2026-07-20 18:02:44 -05:00
spawn-helper-perms.test.ts fix(desktop): resolve unpacked spawn-helper before chmod (#71171) 2026-07-25 15:19:29 -04:00
spawn-helper-perms.ts fix(desktop): resolve unpacked spawn-helper before chmod (#71171) 2026-07-25 15:19:29 -04:00
ssh-bootstrap-coordinator.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
ssh-bootstrap-coordinator.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
ssh-config.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
ssh-config.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
ssh-connection.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
ssh-connection.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
titlebar-overlay-width.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
titlebar-overlay-width.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
update-count.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
update-count.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
update-marker.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
update-marker.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
update-rebuild.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
update-rebuild.ts feat(desktop): ts-ify everything 2026-07-08 16:24:16 -07:00
update-relaunch.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
update-relaunch.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
update-remote.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
update-remote.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
updater-process.test.ts fix(desktop): hide Windows updater console during handoff (#66040) 2026-07-16 22:50:40 -04:00
updater-process.ts fix(desktop): hide Windows updater console during handoff (#66040) 2026-07-16 22:50:40 -04:00
vscode-marketplace.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
vscode-marketplace.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
window-state.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
window-state.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
windows-child-options.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
windows-child-options.ts test(desktop): extract hiddenWindowsChildOptions + stopBackendChild for real unit tests 2026-07-13 17:22:17 -04:00
windows-hermes-path.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
windows-hermes-path.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
windows-remote-lifecycle.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
windows-remote-lifecycle.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
windows-remote-live.test.ts style(desktop): satisfy merged eslint/prettier config 2026-07-20 23:01:49 +02:00
windows-sandbox-fallback.test.ts fix(desktop): harden Windows sandbox fallback against false-positive sandbox loss 2026-07-18 02:26:19 -07:00
windows-sandbox-fallback.ts fix(desktop): harden Windows sandbox fallback against false-positive sandbox loss 2026-07-18 02:26:19 -07:00
windows-system-ca.test.ts fix(desktop): trust Windows system CAs for remote gateways (#66304) 2026-07-17 18:55:34 -04:00
windows-system-ca.ts fmt(js): npm run fix on merge (#66731) 2026-07-18 04:56:56 +00:00
windows-user-env.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
windows-user-env.ts cleanup(desktop): lint&fmt all 2026-07-13 17:22:17 -04:00
workspace-cwd.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
workspace-cwd.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
wsl-clipboard-image.test.ts test(desktop): move node tests to vitest as well 2026-07-13 17:22:17 -04:00
wsl-clipboard-image.ts cleanup(desktop): npm run fix for fmtting 2026-07-08 16:24:16 -07:00
wsl-path-bridge.test.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
wsl-path-bridge.ts fmt(js): npm run fix on merge (#65229) 2026-07-15 21:40:56 +00:00
zoom.test.ts fix(desktop): preserve UI scale after resize 2026-07-18 09:35:01 -07:00
zoom.ts fix(desktop): preserve UI scale after resize 2026-07-18 09:35:01 -07:00