Skip to content

test(query-core): align mutation test filenames with 'mutation.ts' by renaming and merging duplicate '.test-d' files - #11258

Merged
sukvvon merged 1 commit into
mainfrom
test/align-mutation-test-filenames-with-source
Aug 23, 2026
Merged

test(query-core): align mutation test filenames with 'mutation.ts' by renaming and merging duplicate '.test-d' files#11258
sukvvon merged 1 commit into
mainfrom
test/align-mutation-test-filenames-with-source

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 23, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Every other observer/cache module in query-core has its test file(s) named exactly after the source module (query.tsquery.test.tsx, queryObserver.tsqueryObserver.test.tsx + queryObserver.test-d.tsx, mutationCache.tsmutationCache.test.tsx, etc.). mutation.ts was the one exception, split across two misnamed/duplicated files:

  • mutations.test.tsx (plural, should be mutation.test.tsx) → renamed to mutation.test.tsx, and its top-level describe('mutations', ...) renamed to describe('mutation', ...) to match the file.
  • mutations.test-d.tsx was a second .test-d file for the same source module (every other module has exactly one). Its describe('MutateFunction', ...) block (12 cases, including the nested describe('compatible with spread arguments pattern', ...)) was moved as-is into mutation.test-d.tsx, as a sibling of the existing describe('onMutate', ...) block. No cases were changed or dropped — mutation.test-d.tsx now runs 16 tests (4 existing onMutate + 12 moved MutateFunction), same as the sum before the merge. mutations.test-d.tsx is deleted.

Test-only change, no runtime code touched.

✅ 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
    • Added comprehensive compile-time coverage for mutation function parameter inference and invocation across multiple variable and callback types.
    • Consolidated and updated mutation type tests.
    • Renamed the mutation test suite for consistency.

… renaming and merging duplicate '.test-d' files
@sukvvon sukvvon self-assigned this Aug 23, 2026
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ed8b621-71f6-4a86-89ec-287d7bca19fc

📥 Commits

Reviewing files that changed from the base of the PR and between be1352b and b3394b7.

📒 Files selected for processing (3)
  • packages/query-core/src/__tests__/mutation.test-d.tsx
  • packages/query-core/src/__tests__/mutation.test.tsx
  • packages/query-core/src/__tests__/mutations.test-d.tsx
💤 Files with no reviewable changes (1)
  • packages/query-core/src/tests/mutations.test-d.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds compile-time tests for MutateFunction parameter inference and invocation, removes the previous mutation type-test suite, and renames the runtime suite description from mutations to mutation.

Changes

Mutation tests

Layer / File(s) Summary
Mutation function type coverage
packages/query-core/src/__tests__/mutation.test-d.tsx, packages/query-core/src/__tests__/mutations.test-d.tsx
The new type-test suite covers direct and spread-argument MutateFunction calls for optional, required, unknown, any, and union variable types. It also checks DefaultError callback typing and expected invalid calls. The previous type-test suite is removed.
Mutation suite naming
packages/query-core/src/__tests__/mutation.test.tsx
The runtime test suite description changes from mutations to mutation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b3394

This test-only change aligns mutation test filenames and preserves the existing cases, with no published or runtime behavior changes. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the test-file rename and duplicate test-file merge.
Description check ✅ Passed The description explains the changes, confirms test coverage, completes the checklist, and identifies the change as test-only with no release impact.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/align-mutation-test-filenames-with-source

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nx-cloud

nx-cloud Bot commented Aug 23, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit b3394b7

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 35s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-23 03:33:07 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 23, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11258

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: b3394b7

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 8.92 KB (0%)

@sukvvon
sukvvon merged commit 0fe34b4 into main Aug 23, 2026
11 of 12 checks passed
@sukvvon
sukvvon deleted the test/align-mutation-test-filenames-with-source branch August 23, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant