Uh oh!
There was an error while loading. Please reload this page.
test(*): assert exact values instead of loose matchers - #11057
Conversation
View your CI Pipeline Execution ↗ for commit a73f841
☁️ 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 (5)
📝 WalkthroughWalkthroughTests across Lit Query, Query Core, Devtools, and Vue Query now assert exact error values, warning metadata, and thrown messages instead of generic error matchers. ChangesError assertion tightening
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
size-limit report 📦
|
🎯 Changes
Several tests used loose matchers that pass as long as something is present, without checking the actual value. Where the thrown/forwarded value is deterministic (thrown by the test itself, or a fixed source message), the assertions are tightened to the exact value.
lit-query—infinite-and-options,mutation-controller—toBeInstanceOf(Error)→toEqual(new Error('<message>')). Each error is thrown by the test's ownqueryFn/mutationFn(next-page-failed,negative-not-allowed,reset-target), and the siblingrejects.toThrow('<message>')already checks the same message, so theerrorobject is now checked to match it too.query-core—timeoutManager— the second argument of the provider-switch warning wasexpect.anything()(any non-null value); it now asserts the exact{ previous, provider }payload the source passes.query-devtools—Explorer— the clipboard copy failure logsconsole.error('Failed to copy: ', err);expect.any(Error)→ the exactnew Error('denied')the test'swriteTextmock rejects with.vue-query—useQueryClient— baretoThrow()→toThrow('<message>')for the two guards (No 'queryClient' found ...andvue-query hooks can only be used inside setup() ...), which the source throws unconditionally.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit