Conversation
…ext provider, 'client' prop, and production fallback
|
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 (2)
📝 WalkthroughWalkthroughConsolidates and replaces legacy devtools tests by adding two focused Vitest suites— ChangesTest Suite Consolidation & Reorganization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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)
Review rate limit: 3/5 reviews remaining, refill in 12 minutes and 8 seconds. Comment |
|
View your CI Pipeline Execution ↗ for commit 5fd8204
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/react-query-devtools/src/__tests__/ReactQueryDevtools.test.tsx`:
- Around line 65-70: The test relies on the runner NODE_ENV and is brittle; make
it deterministic by setting process.env.NODE_ENV to a non-development value
(e.g., 'production') and calling jest.resetModules() before dynamically
importing the module so the env-gated export in ReactQueryDevtools is
re-evaluated; save the original NODE_ENV, set it to 'production', call
jest.resetModules(), import('..') to get { ReactQueryDevtools }, assert it
returns null, then restore the original NODE_ENV and call jest.resetModules()
again to clean up.
In
`@packages/react-query-devtools/src/__tests__/ReactQueryDevtoolsPanel.test.tsx`:
- Around line 66-71: The test for ReactQueryDevtoolsPanel relies on the ambient
NODE_ENV; update the test so it explicitly stubs process.env.NODE_ENV =
'production', calls jest.resetModules() (or equivalent) and then imports the
module (const { ReactQueryDevtoolsPanel } = await import('..')) to force the
fallback branch, and finally restore the original NODE_ENV; target the test that
references ReactQueryDevtoolsPanel and ensure module reset happens before the
import so the non-development path is deterministic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bf1f792b-03f1-42cd-9a76-3bb9b2a8816f
📒 Files selected for processing (4)
packages/react-query-devtools/src/__tests__/ReactQueryDevtools.test.tsxpackages/react-query-devtools/src/__tests__/ReactQueryDevtoolsPanel.test.tsxpackages/react-query-devtools/src/__tests__/devtools.test.tsxpackages/react-query-devtools/src/__tests__/not-development.test.tsx
💤 Files with no reviewable changes (2)
- packages/react-query-devtools/src/tests/devtools.test.tsx
- packages/react-query-devtools/src/tests/not-development.test.tsx
…ic with 'vi.stubEnv' and 'vi.resetModules'
🎯 Changes
Add tests for
react-query-devtoolscovering wrapper invariants and the production fallback inindex.ts, replacing the existing placeholder.devtools.test.tsxwithReactQueryDevtools.test.tsxcontaining 4 cases:QueryClientis set.QueryClientis provided via<QueryClientProvider>(assertsmountwas called).QueryClientis provided via theclientprop (assertsmountwas called).nullin non-development environments (production fallback inindex.ts).ReactQueryDevtoolsPanel.test.tsxwith the same 4 cases forReactQueryDevtoolsPanel.not-development.test.tsx; the production fallback case is now colocated with each component's tests.ReactQueryDevtools.test.tsx/ReactQueryDevtoolsPanel.test.tsx), aligning with the broader repo convention.This mirrors the pattern recently introduced in
preact-query-devtools(#10626) and brings thereact-query-devtoolstest suite to parity.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit