test(web): provide a default Apollo client in vitest setup#2034
Conversation
Some components and generated composables resolve the default Apollo client asynchronously (e.g. during teardown, after the triggering test has finished). Even with useQuery mocked, this surfaced ~22 "Apollo client with id default not found" unhandled rejections in the full web suite — reported against unrelated files like Modals.test.ts and DowngradeOs.test.ts — adding noise and risking false positives. Provide a no-op default client (InMemoryCache + a terminating link that emits an empty result) in the global vitest setup so resolveClient never throws, regardless of timing. No network calls; useQuery stays mocked. Full web suite: 64 files / 641 tests pass, zero unhandled rejections. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesApollo Client Stub in Vitest Setup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2034 +/- ##
=======================================
Coverage 52.77% 52.78%
=======================================
Files 1035 1035
Lines 72060 72060
Branches 8293 8298 +5
=======================================
+ Hits 38027 38034 +7
+ Misses 33907 33900 -7
Partials 126 126 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
🔄 PR Merged - Plugin Redirected to StagingThis PR has been merged and the preview plugin has been updated to redirect to the staging version. For users testing this PR:
Staging URL: Thank you for testing! 🚀 |
Full web vitest suite emits ~22
Apollo client with id default not foundunhandled rejections, attributed to unrelated files (Modals.test.ts,DowngradeOs.test.ts). They don't fail the build but add noise and risk false positives.They appear only in the full suite (not in isolation): some components/generated composables resolve the default Apollo client asynchronously (during teardown, after the triggering test finished), when no client is in scope; the
useQuerymock doesn't cover those paths.Fix: provide a no-op default Apollo client in
web/vitest.setup.ts(InMemoryCache+ a terminatingApolloLinkemitting an empty result) soresolveClientalways succeeds. No network calls;useQuerystays mocked.Verification: full web suite locally — 64 files / 641 tests pass, zero unhandled rejections (was 22).
Test-harness only; no runtime changes. Split out of #2033, where these were noticed (pre-existing on main, unrelated to that feature).
🤖 Generated with Claude Code
Summary by CodeRabbit
No user-facing changes in this release.