Conversation
…'resetTestingModule' and leveraging provider merging
|
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 (6)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR refactors test setup across multiple Angular Query test files in the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 |
|
View your CI Pipeline Execution ↗ for commit 3dfc0f2
☁️ 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
Simplifies
TestBedsetup across Angular tests by removing redundantresetTestingModule()calls and leveraging Angular's provider merging behavior —configureTestingModule()merges providers on repeated calls, so tests that only need to add extra providers on top of thebeforeEachbaseline no longer have to re-declare the whole provider array.Per-file changes
angular-query-experimental/src/__tests__/inject-is-restoring.test.ts: extract common setup into abeforeEachhook and let theprovideIsRestoringtest merge its extra provider.angular-query-experimental/src/__tests__/inject-mutation.test.ts: drop 4resetTestingModule+configureTestingModuleblocks that just re-declared the exact providers already set up inbeforeEach.angular-query-experimental/src/__tests__/inject-queries.test.ts: move the top-levelbeforeEach/afterEachhooks into thedescribeblock they belong to, and simplify theisRestoringtest to only declare the extra provider it needs.angular-query-experimental/src/__tests__/inject-query.test.ts: remove 3 redundantresetTestingModule+ full re-declaration blocks, and simplify theisRestoring/HttpClienttests to only declare their extra providers.angular-query-experimental/src/__tests__/pending-tasks.test.ts: the nestedHttpClient Integrationdescribe now mergesprovideHttpClient/provideHttpClientTestingon top of the parentbeforeEachinstead of resetting and rebuilding from scratch.angular-query-persist-client/src/__tests__/with-persist-query-client.test.ts: move the top-levelbeforeEach/afterEachhooks into thedescribeblock they belong to, matching the convention used in the rest of the suite.Out of scope
Three
TestBed.resetTestingModule()calls inwith-devtools.test.tsare intentionally preserved — they're either cleanup inafterEachor part of the test's own subject ("injector destroy" behavior), not redundant setup.✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit