Skip to content

test(desktop): one DOM for the whole run and no module mocks - #8319

Merged
saddlepaddle merged 2 commits into
mainfrom
test/desktop-no-module-mocks
Oct 8, 2026
Merged

saddlepaddle merged 2 commits into
mainfrom
test/desktop-no-module-mocks

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Part of removing cross-file test leaks so suites do not depend on bun test --isolate. Draft: the tests pass in any order, but five production components were restructured and none was checked in the running app yet (list at the end).

Why tests depended on file order

  1. mock.module is process-wide in bun. Fakes of renderer/lib/cloud-trpc, host-service-client, @superset/workspace-client, ../env, @superset/local-db, react and others reached every file that loaded later.
  2. happy-dom was registered and unregistered per file (58 register, 52 unregister). After the first unregister, that window's queueMicrotask and setTimeout never fire again. react-dom captures both at import, so in every later DOM file a React update outside act() never rendered. This was the cause of the useDiffCodeViewItems failures.
  3. Leftover state: LanguageAwareI18nProvider.test.tsx left the ja locale active (8月22日 in date tests); six files called a bare mock.restore(), which also tears down the preload's electron mock; two tests replaced globalThis.localStorage.

What changed

  • One DOM per process. test-setup.ts registers happy-dom once, in place of the hand-written document/window stubs, and never unregisters. It then puts back the native fetch, Request, Response, Headers, URL, WebSocket, abort classes, streams, timers and queueMicrotask, so non-DOM tests keep the runtime they had. Per-file register/unregister is removed from about 55 files. Two nested-process fixtures got an isRegistered guard.
  • No mock.module and no bare mock.restore() remain in apps/desktop/src outside the fixtures/ files that run in a nested process. Renderer tests use the real tRPC providers with a fake link, or a local Bun.serve.
  • Main process seams: DaemonTerminalManager, restartDaemon, tryListExistingDaemonSessions, the host-service coordinator and lock, ai-name, WorkerTaskRunner, killPortTarget, terminal-ws-transport and browserRuntimeRegistry take an optional dependency that defaults to the previous import.
  • Renderer logic moved out of hooks into functions: openNewWorkspace, openNewSession, openNewWorkspaceForLocalProject, importFolderFirst, invalidateGitQueries, resolveStatusRefetchInterval, useIsV1FlipLockedFor, useIsV2CloudEnabledFor.
  • PostHogLocaleTagger moved from inside LanguageAwareI18nProvider to its first child in routes/-layout.tsx, the only place that renders the provider.
  • useDiffCodeViewItems reads the client from workspaceTrpc.useUtils(); WorkspaceClientProvider passes the same client to both.

Components split into a container and a props-driven part

Original New part Pure move?
PagesView PagesList JSX and classes identical. Hook order changed: session, favorites, workspace names and create-with-agent now run in the parent first. New optional searchDebounceMs.
PageWatcherMenu PageWatcherPopover JSX, classes and mutations identical. Five data hooks moved to the parent in the same order; host client and agent picker arrive as props.
AgentSessionPicker AgentSessionSelect JSX and classes identical. The popover is controlled through open/onOpenChange props carrying the same state.
ExperimentalSettings ExperimentalSettingsList Yes. Three session booleans arrive as props.
V2ProjectSettings V2ProjectSettingsBody JSX and classes identical. Three sections that need more providers are passed in as nodes at their original positions.

Tests

  • 7,979 tests in 531 files (7,969 in 526 before).
  • Deleted: V2ProjectSettings.test.tsx; its three tests asserted that mocked children appeared. Replaced by V2ProjectSettingsBody.test.tsx, which renders the real children and guards the Project icons are missing in 1.16 #5843 regression (icon picker present and enabled).
  • Renamed with their tests kept: PagesView.test → PagesList.test (19), PageWatcherMenu.test → PageWatcherPopover.test (26), useFolderFirstImport.test → importFolderFirst.test, useGitStatus.test → invalidateGitQueries.test plus a new useGitStatus.test against a local WebSocket host. ExperimentalSettings: four tests became three.
  • Not covered: nothing fails if V2ProjectSettings stops rendering the body or drops one of its three passed-in sections. useOpenNewWorkspaceForLocalProject is tested as a function, not through the hook, because a mounted authClient.useSession() makes a real request.

Verification

bun 1.4.2, bun test --randomize --seed N: seeds 1-14 pass without --isolate (about 38 s) and seeds 1-13 pass with it (about 73 s). One --isolate run of seed 1 had four git and shell tests time out while the machine was overloaded, and passed on rerun. Repo typecheck, biome and check:i18n pass.

Before this leaves draft

Check in the running app: the Pages list (search, favorites, create with agent), the page watcher menu, the agent session picker, Experimental settings, V2 project settings, folder-first repository import, and that the PostHog locale tag is still set.


Summary by cubic

Makes the desktop test suite pass in any order without bun test --isolate by removing the cross-file leaks behind the order dependence: process-wide mock.module calls, per-file happy-dom registration, and leftover global state. Still a draft: five production components were split and need checking in the running app (Pages list, page watcher menu, agent session picker, Experimental/V2 project settings, folder-first import, PostHog locale tag). Verified with bun test --randomize seeds 1–14 without --isolate and 1–13 with it.

Why tests depended on order

  • mock.module is process-wide in bun, so mocks from one file reached every later file's imports.
  • Per-file happy-dom register/unregister broke queueMicrotask and setTimeout, so React updates outside act() never rendered in later DOM files.
  • Leftover state: the ja locale stayed active, six files called a bare mock.restore() that tore down the preload's electron mock, and two tests replaced globalThis.localStorage.

What changed

  • test-setup.ts registers happy-dom once per process, never unregisters it, and restores native fetch, WebSocket, streams, timers, and queueMicrotask; per-file register/unregister removed from ~55 files.
  • No mock.module or bare mock.restore() remain outside fixtures/; renderer tests use real tRPC providers with a fake link or a local Bun.serve.
  • Main-process code and renderer logic take optional dependency parameters that default to their previous imports.
  • Five components split into a container and a props-driven part (PagesList, PageWatcherPopover, AgentSessionSelect, ExperimentalSettingsList, V2ProjectSettingsBody); V2ProjectSettings.test.tsx replaced by V2ProjectSettingsBody.test.tsx.

Written for commit 1dfd5d5. Summary will update on new commits.

View guided diff Turn on auto-fix

Two things made desktop tests depend on file order without --isolate.

mock.module is process-wide in bun. Fakes of renderer/lib/cloud-trpc,
host-service-client, @superset/workspace-client, ../env and others reached
later files. Tests now use real providers with fake links, or the code
takes its dependency as an optional parameter.

58 files registered happy-dom and 52 unregistered it. After the first
unregister, that window's timers never fire again, and react-dom captured
them at import, so React updates outside act() never rendered in later
files. happy-dom is now registered once in the preload.

A test also left the ja locale active, and six files called a bare
mock.restore() that tore down the preload's electron mock.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ee5b1cc-8194-4fb5-94b1-ec195b8d43de
📥 Commits

Reviewing files that changed from the base of the PR and between 141055a and 1dfd5d5.

📒 Files selected for processing (135)
  • apps/desktop/src/lib/electron-app/factories/app/setup.test.ts
  • apps/desktop/src/lib/trpc/routers/auth/utils/auth-functions.test.ts
  • apps/desktop/src/lib/trpc/routers/changes/utils/merge-pull-request.test.ts
  • apps/desktop/src/lib/trpc/routers/permissions/native-permissions.test.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/ai-name.test.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/ai-name.ts
  • apps/desktop/src/lib/trpc/workers/WorkerTaskRunner.test.ts
  • apps/desktop/src/lib/trpc/workers/WorkerTaskRunner.ts
  • apps/desktop/src/main/lib/browser/browser-manager.test.ts
  • apps/desktop/src/main/lib/host-service-coordinator.test.ts
  • apps/desktop/src/main/lib/host-service-coordinator.ts
  • apps/desktop/src/main/lib/host-service-lock.test.ts
  • apps/desktop/src/main/lib/host-service-lock.ts
  • apps/desktop/src/main/lib/terminal/daemon/daemon-manager.test.ts
  • apps/desktop/src/main/lib/terminal/daemon/daemon-manager.ts
  • apps/desktop/src/main/lib/terminal/index.test.ts
  • apps/desktop/src/main/lib/terminal/index.ts
  • apps/desktop/src/main/lib/window-state/bounds-validation.test.ts
  • apps/desktop/src/renderer/components/LanguageAwareI18nProvider/LanguageAwareI18nProvider.test.tsx
  • apps/desktop/src/renderer/components/LanguageAwareI18nProvider/LanguageAwareI18nProvider.tsx
  • apps/desktop/src/renderer/components/MarkdownEditor/components/RecordMention/RecordMentionNode.test.ts
  • apps/desktop/src/renderer/components/MarkdownRenderer/components/TipTapMarkdownRenderer/createMarkdownExtensions.test.ts
  • apps/desktop/src/renderer/components/MarkdownRenderer/components/TipTapMarkdownRenderer/mergeMarkdownEdits.roundtrip.test.ts
  • apps/desktop/src/renderer/components/MarkdownRenderer/components/TipTapMarkdownRenderer/resolveLinkClick.test.ts
  • apps/desktop/src/renderer/components/NewWorkspaceModal/components/PromptGroup/components/CompareBaseBranchPickerInline/CompareBaseBranchPickerInline.test.tsx
  • apps/desktop/src/renderer/components/Paywall/usePaywall.test.tsx
  • apps/desktop/src/renderer/components/Paywall/usePaywall.ts
  • apps/desktop/src/renderer/components/PluginMention/PluginMentionNode.test.ts
  • apps/desktop/src/renderer/components/PluginMention/utils/restorePluginMentions/restorePluginMentions.test.ts
  • apps/desktop/src/renderer/components/Redirect/Redirect.test.tsx
  • apps/desktop/src/renderer/components/TiptapPromptEditor/serializeEditorToText.test.ts
  • apps/desktop/src/renderer/components/WorkspaceNameMarquee/WorkspaceNameMarquee.test.tsx
  • apps/desktop/src/renderer/hooks/host-service/useGitStatus/invalidateGitQueries.test.ts
  • apps/desktop/src/renderer/hooks/host-service/useGitStatus/invalidateGitQueries.ts
  • apps/desktop/src/renderer/hooks/host-service/useGitStatus/useGitStatus.test.tsx
  • apps/desktop/src/renderer/hooks/host-service/useGitStatus/useGitStatus.ts
  • apps/desktop/src/renderer/hooks/ports/usePortKillActions/confirmClosePorts.test.ts
  • apps/desktop/src/renderer/hooks/ports/usePortKillActions/killPortTarget.test.ts
  • apps/desktop/src/renderer/hooks/ports/usePortKillActions/killPortTarget.ts
  • apps/desktop/src/renderer/hooks/useAgentLaunchPreferences/useAgentLaunchPreferences.test.ts
  • apps/desktop/src/renderer/hooks/useAgentSessionPlacement/useAgentSessionPlacement.test.tsx
  • apps/desktop/src/renderer/hooks/useIsV2CloudEnabled.test.tsx
  • apps/desktop/src/renderer/hooks/useIsV2CloudEnabled.ts
  • apps/desktop/src/renderer/hooks/useOpenNewWorkspace/useOpenNewWorkspace.test.ts
  • apps/desktop/src/renderer/hooks/useOpenNewWorkspace/useOpenNewWorkspace.ts
  • apps/desktop/src/renderer/lib/agent-session-orchestrator/agent-session-orchestrator.test.ts
  • apps/desktop/src/renderer/lib/api-trpc-client.test.ts
  • apps/desktop/src/renderer/lib/persistent-hash-history/persistent-hash-history.test.ts
  • apps/desktop/src/renderer/lib/radix-layers/bodyPointerEventsLock.test.tsx
  • apps/desktop/src/renderer/lib/radix-layers/inputGroupPopover.test.tsx
  • apps/desktop/src/renderer/lib/terminal/terminal-runtime-registry.test.ts
  • apps/desktop/src/renderer/lib/terminal/terminal-ws-transport.test.ts
  • apps/desktop/src/renderer/lib/terminal/terminal-ws-transport.ts
  • apps/desktop/src/renderer/lib/tiptap/markdown-attributes.test.ts
  • apps/desktop/src/renderer/lib/v1-migration/v1-migration.test.ts
  • apps/desktop/src/renderer/routes/-layout.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/components/AutomationBody/hooks/useAutomationDraft/useAutomationDraft.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/TriggerSentence/components/ScopeChip/ScopeChip.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/TriggersEditor/TriggerMenuItems/TriggerMenuItems.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/TriggersEditor/components/RuntimeWarnings/RuntimeWarnings.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/providers/github/components/TokenField/TokenField.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/providers/github/github.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/providers/schedule/schedule.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/providers/slack/components/EmojiNameChip/EmojiNameChip.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/providers/slack/slack.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AddRepositoryModals/hooks/useFolderFirstImport/importFolderFirst.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AddRepositoryModals/hooks/useFolderFirstImport/importFolderFirst.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AddRepositoryModals/hooks/useFolderFirstImport/useFolderFirstImport.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AgentSessionPicker/AgentSessionPicker.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AgentSessionPicker/AgentSessionPicker.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AgentSessionPicker/components/AgentSessionSelect/AgentSessionSelect.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AgentSessionPicker/components/AgentSessionSelect/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AgentSessionPicker/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarDeleteDialog/components/DestroyConfirmPane/DestroyConfirmPane.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/components/DashboardSidebarWorkspaceChips/fixtures/checks.test.fixture.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/DashboardSidebarWorkspaceHoverCardContent.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspacesHeader/hooks/useProjectFilterExpanded/useProjectFilterExpanded.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarShortcuts/fixtures/navigation.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pages/components/PagesView/PagesView.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pages/components/PagesView/PagesView.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pages/components/PagesView/components/PagesList/PagesList.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pages/components/PagesView/components/PagesList/PagesList.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pages/components/PagesView/components/PagesList/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pull-requests/components/PullRequestsView/components/PullRequestsTopBar/components/AuthorFilter/AuthorFilter.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/CommentsSection/components/CommentRow/CommentRow.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabActions/useFilesTabActions.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useDiffPaneTarget/useDiffPaneTarget.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/BrowserPane/browserRuntimeRegistry.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/BrowserPane/browserRuntimeRegistry.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Composer/hooks/useComposerDraft/useComposerDraft.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/PageLinkCard/PageLinkCard.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/PageLinkCard/components/ChatPageCard/ChatPageCard.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/SessionView/hooks/useStableList/useStableList.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatSession/components/Transcript/hooks/useScrollAnchorKey/useScrollAnchorKey.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/CommentThread/CommentThread.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/hooks/useDiffCodeViewItems/useDiffCodeViewItems.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/hooks/useDiffCodeViewItems/useDiffCodeViewItems.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FilePane/registry/views/CodeView/hooks/usePendingFilePosition/usePendingFilePosition.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/PagePaneHeaderExtras/components/PageWatcherMenu/PageWatcherMenu.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/PagePaneHeaderExtras/components/PageWatcherMenu/components/PageWatcherPopover/PageWatcherPopover.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/PagePaneHeaderExtras/components/PageWatcherMenu/components/PageWatcherPopover/PageWatcherPopover.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/PagePaneHeaderExtras/components/PageWatcherMenu/components/PageWatcherPopover/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/PullRequestPane/components/PullRequestCommentCard/PullRequestCommentCard.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useHostReachability/useHostReachability.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/stores/v2WorkspacesFilterStore/v2WorkspacesFilterStore.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/hooks/useProjectPreselection/useProjectPreselection.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsx
  • apps/desktop/src/renderer/routes/_authenticated/providers/HostWorkspacesProvider/HostWorkspacesProvider.tsx
  • apps/desktop/src/renderer/routes/_authenticated/providers/HostWorkspacesProvider/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/providers/LocalHostServiceProvider/LocalHostServiceProvider.tsx
  • apps/desktop/src/renderer/routes/_authenticated/providers/LocalHostServiceProvider/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/providers/SandboxAccessProvider/SandboxAccessProvider.tsx
  • apps/desktop/src/renderer/routes/_authenticated/providers/SandboxAccessProvider/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/experimental/components/ExperimentalSettings/ExperimentalSettings.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/experimental/components/ExperimentalSettings/ExperimentalSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/experimental/components/ExperimentalSettings/components/ExperimentalSettingsList/ExperimentalSettingsList.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/experimental/components/ExperimentalSettings/components/ExperimentalSettingsList/ExperimentalSettingsList.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/experimental/components/ExperimentalSettings/components/ExperimentalSettingsList/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/usage/components/LeaderboardCard/components/LeaderboardRank/LeaderboardRank.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/V2ProjectSettings.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/V2ProjectSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/IconUploadField/IconUploadField.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/NamingInstructionsSection/NamingInstructionsSection.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/SparseCheckoutSection/SparseCheckoutSection.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/V2ProjectSettingsBody/V2ProjectSettingsBody.test.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/V2ProjectSettingsBody/V2ProjectSettingsBody.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/V2ProjectSettingsBody/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/hooks/useFileContent/useFileContent.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/hooks/useTerminalLifecycle.attach.test.ts
  • apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/useGitChangesStatus.test.ts
  • apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/useGitChangesStatus.ts
  • apps/desktop/src/renderer/stores/theme/utils/terminal-theme-type.test.ts
  • apps/desktop/src/xterm-ime-patch.test.ts
  • apps/desktop/src/xterm-render-debouncer-patch.test.ts
  • apps/desktop/test-setup.ts
 _____________________
< 🧯 Bug extinguished. >
 ---------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle marked this pull request as ready for review October 8, 2026 05:57
@saddlepaddle
saddlepaddle merged commit fd01cf0 into main Oct 8, 2026
17 of 18 checks passed
@saddlepaddle
saddlepaddle deleted the test/desktop-no-module-mocks branch October 8, 2026 06:04
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Test infrastructure refactored to remove module mocks.

Fix the shared storage setup before merging so randomized tests cannot inherit saved agent choices.

What we checked:

  • Locale tags keep their provider: RootLayout still renders the tagger inside LanguageAwareI18nProvider, which renders its children inside I18nProvider.

Summary

Makes desktop tests share one DOM and replaces process-wide module mocks with passed-in dependencies and real providers.

  • Splits page, agent, and settings components into containers and smaller views.
  • Preserves the locale tagger’s position inside the language provider.
  • Fix the two separate storage objects before merging; current cleanup misses saved agent choices.

Acknowledged by saddlepaddle: container coverage and mounted local-project hook coverage remain incomplete, and running-app checks are still pending while the PR is a draft.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Setup["test-setup.ts"] --> DOM["One happy-dom window"]
  Setup --> Global["globalThis.localStorage mock"]
  DOM --> Window["window.localStorage"]
  Tests["Watcher test cleanup"] --> Global
  Hooks["Agent preference hooks"] --> Window
  Window --> Saved["Saved choices survive cleanup"]
Loading

Reviews (1) · Last reviewed commit: "test(desktop): one DOM for the whole run..." · Reviewed by Greptile

@greptile-apps

greptile-apps Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P1 Saved choices survive test cleanup apps/desktop/test-setup.ts:96 ▶

    test-setup.ts replaces globalThis.localStorage after happy-dom creates window.localStorage, leaving two separate stores. PageWatcherPopover.test.tsx clears the global store, but setAgentSessionPlacement and useAgentSessionTarget use the window store.

    If “uses the Settings placement for a new session” runs before “launches a configured agent,” the saved new-tab survives cleanup and breaks the expected split-pane result. Install the same storage object on both globals so cleanup reaches the store the hooks use.

saddlepaddle added a commit that referenced this pull request Oct 8, 2026
* test: run suites without --isolate and remove three flaky tests

The cross-file leaks that --isolate hid are fixed (#8314, #8315, #8316,
#8319), so each package's suite now runs in one process. The desktop suite
takes about 38 s without the flag and about 73 s with it.

apps/relay still had one leak: host-tunnel.test.ts replaced partyserver
with a stub that has no getServerByName, which broke index.test.ts in some
file orders. The test passes against the real module, so the stub is gone.

Removed as flaky:
- workspace-fs: FsWatcherManager resumes a subscription after the root is
  deleted and recreated
- i18n: locale changes preserve state and focus (provider-state)
- agent-setup: Pi completion notifications, which poll up to 1 s for a
  detached script

* test(trpc): keep the opt-in Postgres watch test out of the shared suite

It sets DATABASE_URL and then imports the db client. In one process the
client may already exist, so the test would write its fixtures to the
database the first file connected to. As an .integration.ts file it runs
only when named, in its own process, like the other opt-in suites.
pgilmore added a commit to patiently/superset that referenced this pull request Oct 11, 2026
Merges upstream main into the watcher build. Upstream now runs each test
suite in one process and bans module mocks in the desktop suite (ParadevAI#8319,
ParadevAI#8336), so the hover-card test drives the real hooks against a fake host
instead of mocking them. Tests run on the bun canary upstream's CI uses,
because bun 1.4.2 can hang in a synchronous spawn.

Claude-Session: https://claude.ai/code/session_01CZBCrRCZ2rEBHv4DH3Wh3k
MagnusPladsen added a commit to MagnusPladsen/superset that referenced this pull request Oct 13, 2026
Resolve the V2ProjectSettings conflict from ParadevAI#8319 by moving the Color
row into the new V2ProjectSettingsBody, wired to onHostProjectChanged.
Regenerate the i18n catalogs so entry order stays deterministic.

Co-Authored-By: AI Assistant <noreply@example.com>

This branch was previously deployed

1 inactive deployment
preview — 1dfd5d57 Deployed Oct 8, 2026 by saddlepaddle via Deploy Database (Neon) #11524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant