test(vue-query/useMutation): add test for outside scope warning in development mode#10238
test(vue-query/useMutation): add test for outside scope warning in development mode#10238sukvvon wants to merge 2 commits intoTanStack:mainfrom
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 9621bea
☁️ Nx Cloud last updated this comment at |
|
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)
📝 WalkthroughWalkthroughAdds two tests in 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 |
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__/useMutation.test.ts`:
- Around line 389-402: The test sets NODE_ENV and spies on console.warn around a
call to useMutation but doesn't guarantee cleanup if the test throws; wrap the
call and assertions in a try/finally block and in finally call
vi.unstubAllEnvs() and restore the spy (e.g., warnSpy.mockRestore() or
vi.restoreAllMocks()) so environment stubs and the console.warn spy are always
restored; locate this change around the existing useMutation invocation and the
warnSpy variable in the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5ac6d489-18ec-4d7b-92ed-dd18c904bdcc
📒 Files selected for processing (1)
packages/vue-query/src/__tests__/useMutation.test.ts
… 'try/finally' for cleanup safety
🎯 Changes
useMutationwarns when used outside of asetup()function or running effect scope in development mode.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit