test(desktop): remove flaky git-status.test.ts that leaks mocks across files#3624
Conversation
📝 WalkthroughWalkthroughRemoved a Git status test file, added a nullable Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance. |
…ss files The test used `mock.module()` to stub `node:fs`, `@superset/local-db`, `../utils/git`, `../utils/github`, and `drizzle-orm`. In the Bun test runner these module mocks persist for the remainder of the process, so every subsequent test file that imported those paths saw the stubs instead of the real exports. On Linux CI the iteration order placed `git-status.test.ts` before the affected files, producing 10 unrelated failures: `listExternalWorktrees` (mocked to return `[]`), all seven `resolveCwd` cases (`existsSync` forced to `true`, breaking `pathExistsCached`), `mergePullRequest` (missing `getRepoContext` on the mocked `utils/github` module), and the "worktrees not found" syntax error from the narrower `@superset/local-db` override. The procedure-level coverage here was thin (mostly branch/worktree branching in getGitHubStatus/getWorktreeInfo) and not worth the cross-file fallout, so drop the file.
…ration Three navigate/Navigate callers pointed at the removed `/settings/project/$projectId/general` route; switch them to the consolidated `/settings/projects/$projectId` page that replaced it. Also expose `neonProjectId` on the project object returned by `workspaces.getAllGrouped`, since `ProjectsSettingsSidebar` now uses it to hide v1 rows whose v2 counterpart has already loaded.
14d86c6 to
910309b
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
Fixes the 10 unrelated test failures that have been red-ing CI on
mainfor the last several pushes.The root cause was
apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.test.ts. It usedmock.module()to stubnode:fs,@superset/local-db,../utils/git,../utils/github, anddrizzle-orm. In the Bun test runner these module mocks persist for the remainder of the process — there's nomock.restore()path for module mocks — so every later test file that imported those paths saw the stubs instead of the real exports. On Linux CI the discovery order placed this file first, producing:listExternalWorktrees detects external worktree—../utils/gitmock returned[]resolveCwd > …cases —node:fs.existsSyncforced totrue, breakingpathExistsCachedmergePullRequest > (unnamed)— mocked../utils/githubwas missinggetRepoContext, sospyOnfailedUnhandled error … Export named 'worktrees' not found …— narrower@superset/local-dbmock dropped most exportsI tried surgically backfilling the missing exports first, but any shape given to those mocks broke a different downstream test. Since the procedure-level coverage here was thin (branch vs. worktree branching in
getGitHubStatus/getWorktreeInfo) and not worth the cross-file fallout, this PR drops the file.Test plan
bun testinapps/desktop→ 1762 pass, 0 fail (was 1751 pass / 10 fail / 1 error on CI)bun run typecheckacross all 25 packages → cleanbun run lint→ cleanSummary by CodeRabbit
Tests
Data
Navigation
Summary by cubic
Removed a flaky Git status test that leaked Bun module mocks across files and fixed v2 settings migration fallout (routing and types). This restores consistent tests and fixes project settings navigation.
git-status.test.tsthat used Bunmock.module()to stubnode:fs,@superset/local-db,../utils/git,../utils/github, anddrizzle-orm, with mocks persisting across files./settings/projects/$projectIdand exposedneonProjectIdinworkspaces.getAllGroupedfor the new sidebar.apps/desktoptests pass locally (1762 pass, 0 fail); repo typecheck and lint are clean.Written for commit 910309b. Summary will update on new commits.