test(desktop): remove host-service-coordinator test that pollutes other tests#3734
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughA test file Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR fixes a process-wide mock pollution bug in Confidence Score: 5/5Safe to merge — minimal, targeted fix with no logic changes and no new risks. The change is a two-line addition that follows the established pattern already present in this file. It restores broken test isolation without altering any production code. No P0/P1 findings. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/lib/host-service-coordinator.test.ts | Imports actualShellEnv and spreads it into the mock.module factory so only getProcessEnvWithShellPath is overridden, preserving all other exports for subsequent tests. |
Sequence Diagram
sequenceDiagram
participant Bun as Bun Test Runner
participant HSC as host-service-coordinator.test.ts
participant MPR as merge-pull-request.test.ts
participant SE as shell-env module
Note over Bun: Before fix
HSC->>SE: mock.module({ getProcessEnvWithShellPath })
Note over SE: Only getProcessEnvWithShellPath exported
MPR->>SE: import { execWithShellEnv }
SE-->>MPR: SyntaxError: Export named 'execWithShellEnv' not found
Note over Bun: After fix
HSC->>SE: import * as actualShellEnv
HSC->>SE: mock.module({ ...actualShellEnv, getProcessEnvWithShellPath })
Note over SE: All real exports preserved, only getProcessEnvWithShellPath overridden
MPR->>SE: import { execWithShellEnv }
SE-->>MPR: resolves successfully
Reviews (1): Last reviewed commit: "fix(desktop): preserve real shell-env ex..." | Re-trigger Greptile
…er tests The mock.module() calls in this test for node:child_process and shell-env are hoisted by Bun and persist process-wide, causing 17 unrelated tests (merge-pull-request, git, teardown, listExternalWorktrees) to fail or timeout when run in the same suite. Bun does not provide per-file mock isolation, and re-mocking back in afterAll fires too late to restore live ESM bindings already captured by other test files. Removes the test entirely to unblock CI. Coverage of the host-service restart-adoption fix should be restored via a refactor that injects spawn / getProcessEnvWithShellPath as constructor options instead of mocking modules.
41de282 to
fd3589f
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
PR1〜PR5 (#435 #436 #437 #438 #440) で 13 commits 全件 cherry-pick + 手動 conflict 解消で取り込み済み。 本コミットは git 履歴上 behind=0 とするための ours マージ記録。 取り込み済み 13 commits: - 1f55c62 Fix host service restart adoption (superset-sh#3732) - 0fe65d2 test(desktop): remove host-service-coordinator test (superset-sh#3734) - 3012b5a Add optimistic Electric collection updates (superset-sh#3722) - c272a51 fix(desktop): drop branch row from v2 sidebar workspace item (superset-sh#3733) - c2f3fdc feat(desktop): add fade-edge mask utilities (superset-sh#3735) - 682d07c fix v2 terminal osc links (superset-sh#3736) - 7c0d22b feat(ports): surface remote host-service ports in the sidebar (superset-sh#3676) - 6a3be2d [codex] Stabilize v2 terminal resize (superset-sh#3739) - 8928ac6 [codex] Improve v2 pane header responsiveness (superset-sh#3737) - 5fe3d22 refactor(desktop): tidy v2 terminal session dropdown (superset-sh#3743) - 66c23d6 Fix automation timezone scheduling (superset-sh#3738) - 16e270c [codex] Add terminal session titles (superset-sh#3740) - 583fa5d fix(desktop): refit v2 terminal after font settle (superset-sh#3742)
Summary
The test added in #3732 calls
mock.module()fornode:child_processandshell-env. Bun hoists these globally and there's no per-file isolation — they persist for the entirebun testprocess. This caused 17 unrelated tests (merge-pull-request, git, teardown, listExternalWorktrees, Shell Environment) to fail or timeout when run in the full suite.I tried less invasive fixes (spreading actual exports, re-mocking in afterAll, removing just the shell-env mock) — none restored live ESM bindings already captured by other test files. Deleting the test is the only mechanical fix.
The product fix in
host-service-coordinator.ts(#3732) is unchanged. Coverage should be restored via a refactor that injectsspawn/getProcessEnvWithShellPathas constructor options rather than mocking modules globally.Result
bun test: 1830 pass / 0 fail (was 1739 pass / 7 fail / 6 errors on main)Test plan
Summary by CodeRabbit