Skip to content

test(*): replace deprecated 'toThrowError' with 'toThrow'#10405

Merged
sukvvon merged 1 commit intomainfrom
test/replace-deprecated-toThrowError-with-toThrow
Apr 6, 2026
Merged

test(*): replace deprecated 'toThrowError' with 'toThrow'#10405
sukvvon merged 1 commit intomainfrom
test/replace-deprecated-toThrowError-with-toThrow

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 6, 2026

🎯 Changes

  • Replace deprecated toThrowError with toThrow across all test files
  • Applied to angular-query-experimental, query-async-storage-persister, query-core, svelte-query, and vue-query

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated test assertions across multiple packages to use standardized error-matching matchers, improving test consistency and clarity without impacting user-facing functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 392346de-1fb1-42b5-a996-87aae05f124b

📥 Commits

Reviewing files that changed from the base of the PR and between 1493433 and 9ad1e29.

📒 Files selected for processing (12)
  • packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-fetching.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-mutating.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-restoring.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-mutation-state.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-query.test.ts
  • packages/query-async-storage-persister/src/__tests__/asyncThrottle.test.ts
  • packages/query-core/src/__tests__/queryObserver.test.tsx
  • packages/svelte-query/tests/context/context.svelte.test.ts
  • packages/vue-query/src/__tests__/useMutation.test.ts
  • packages/vue-query/src/__tests__/useQueryClient.test.ts

📝 Walkthrough

Walkthrough

This pull request systematically updates test assertions across 11 test files in multiple packages, converting Jest/Vitest matcher methods from toThrowError(...) to toThrow(...) while keeping the same error patterns and assertions intact. No implementation code or test logic changes.

Changes

Cohort / File(s) Summary
Angular Query Experimental Injection Context Tests
packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts, inject-is-fetching.test.ts, inject-is-mutating.test.ts, inject-is-restoring.test.ts, inject-mutation-state.test.ts, inject-query.test.ts
Updated assertions for NG0203 error tests to use toThrow() instead of toThrowError() with consistent regex patterns.
Angular Query Mutation Tests
packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts
Changed both rejects.toThrowError() to rejects.toThrow() for throwOnError cases and updated injection context error matcher to use toThrow().
Query Core Observer Tests
packages/query-core/src/__tests__/queryObserver.test.tsx
Updated invalid enabled option test assertion from toThrowError() to toThrow().
Async Storage Persister Tests
packages/query-async-storage-persister/src/__tests__/asyncThrottle.test.ts
Changed invalid input error assertion from toThrowError() to toThrow().
Svelte Query Context Tests
packages/svelte-query/tests/context/context.svelte.test.ts
Replaced toThrowError() and not.toThrowError() with toThrow() and not.toThrow() matchers.
Vue Query Tests
packages/vue-query/src/__tests__/useMutation.test.ts, useQueryClient.test.ts
Updated error assertions in async mutation tests and injection context tests to use toThrow() instead of toThrowError().

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop through tests, so consistent and bright,
We swap out toThrowError for toThrow—feeling right!
Same patterns, same errors, just cleaner API,
Across every package, the changes align spry.
Tests stay robust while the matchers renew,
A rabbit-approved refactor shining brand new! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing deprecated Jest/Vitest matcher toThrowError with toThrow across test files.
Description check ✅ Passed The description covers the main changes and impact, with appropriate checklist completion for a test-only/dev change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/replace-deprecated-toThrowError-with-toThrow

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 6, 2026

View your CI Pipeline Execution ↗ for commit 9ad1e29

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 58s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-06 12:31:10 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@sukvvon sukvvon self-assigned this Apr 6, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 6, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10405

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10405

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10405

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10405

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10405

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10405

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10405

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10405

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10405

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10405

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10405

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10405

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10405

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10405

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10405

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10405

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10405

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10405

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10405

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10405

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10405

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10405

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10405

commit: 9ad1e29

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon merged commit e919c54 into main Apr 6, 2026
13 of 14 checks passed
@sukvvon sukvvon deleted the test/replace-deprecated-toThrowError-with-toThrow branch April 6, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant