test(vue-query/useIsFetching): add test for outside scope warning in development mode#10237
test(vue-query/useIsFetching): add test for outside scope warning in development mode#10237sukvvon wants to merge 2 commits intoTanStack:mainfrom
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)
📝 WalkthroughWalkthroughA new unit test was added that ensures a development-mode warning is emitted when Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 2afeaa5
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/vue-query/src/__tests__/useIsFetching.test.ts`:
- Around line 103-109: The test around useIsFetching currently stubs NODE_ENV
and console.warn then calls useIsFetching but restores them unconditionally
after the call; wrap the setup and assertion (the vi.stubEnv('NODE_ENV',
'development'), vi.spyOn(console, 'warn') and the useIsFetching() invocation) in
a try/finally block and move vi.unstubAllEnvs() and the spy restore (the
mockImplementation reset/spy restore) into the finally so NODE_ENV and
console.warn are always restored even if useIsFetching() throws.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c17b9410-5d89-4a5d-af40-171736bea68f
📒 Files selected for processing (1)
packages/vue-query/src/__tests__/useIsFetching.test.ts
…th 'try/finally' for cleanup safety
🎯 Changes
useIsFetchingwarns when used outside of asetup()function or running effect scope in development mode.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit