test(*): resolve 'require-await' warnings in test files#10551
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 (4)
📝 WalkthroughWalkthroughTest-only modifications across multiple packages to adjust how mock Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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)
Comment |
|
View your CI Pipeline Execution ↗ for commit 7a2fa29
☁️ 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 📦
|
🎯 Changes
Resolves the 8
@typescript-eslint/require-awaitwarnings that existed in real test files acrossquery-core,react-query, andsolid-query. Three distinct strategies are applied depending on what each case actually needs.Strategy 1 —
async→ non-async withPromise.resolve/Promise.rejectUsed in
queryFncallbacks whoseasynckeyword was leftover afterawaitwas removed. The resulting function still returns aPromise<T>, so TanStack Query keeps routing the call through the async path. Semantically identical toasync+throw, following the existing repo pattern (e.g.query-core/__tests__/query.test.tsx:913-916,hydration.test.tsx:198, 1285).query-core/__tests__/queryObserver.test.tsx:1484, 1523— call-count-basedqueryFnreact-query/__tests__/useQuery.test.tsx:5678—async () => { count++; return \data${count}` }`solid-query/__tests__/useQuery.test.tsx:5946— same pattern as aboveStrategy 2 — drop
asyncfromitcallbacks that never awaitUsed when
it(..., async () => { ... })had noawaitin the body.solid-query/__tests__/useQuery.test.tsx:3953— simple render + DOM assertionsolid-query/__tests__/useQuery.test.tsx:5020— simple render + hash count assertionStrategy 3 —
eslint-disable-next-linefor unavoidableasync function*The
streamFnpassed tostreamedQuerymust return anAsyncIterable, and droppingasyncwould break the type. These two call sites happen not to have anyawait/for awaitin their body (which is why eslint flags them), but every otherstreamFnin the same file does and is already warn-free. Matches the existing disable-comment style in this repo (// eslint-disable-next-line <rule>with no reason trailer).query-core/__tests__/streamedQuery.test.tsx:553, 715Out of scope
28 additional
require-awaitwarnings remain inpackages/query-codemods/src/*/__testfixtures__/— those files are codemod input/output fixtures that intentionally mirror user code shapes and must not be modified.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit