Skip to content

test(*): rename 'console.error' spies to 'consoleErrorMock' - #11646

Merged
sukvvon merged 2 commits into
mainfrom
test/rename-console-error-spy-to-console-error-mock
Sep 25, 2026
Merged

sukvvon merged 2 commits into
mainfrom
test/rename-console-error-spy-to-console-error-mock

Conversation

@sukvvon

@sukvvon sukvvon commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

Renames every named console.error spy in the test suites to consoleErrorMock, so the name states which console method is mocked:

Before After Packages
consoleMock consoleErrorMock query-core, react-query, preact-query, solid-query, svelte-query, vue-query (useMutation only), query-persist-client-core, react-query-persist-client, solid-query-persist-client, svelte-query-persist-client, angular-query-persist-client
consoleErrorSpy consoleErrorMock query-core (timeoutManager, utils), react-query, preact-query, angular-query-experimental
consoleError consoleErrorMock query-devtools (Explorer, PiPContext)

In vue-query, only the console.error spy in useMutation is renamed; the other consoleMock spies there mock console.warn and are left unchanged.

Renames only; no test behavior changes.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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
    • Standardized error-log spy naming across framework and persistence tests. Existing error handling, logging assertions, and test behavior remain unchanged.

@sukvvon sukvvon self-assigned this Sep 25, 2026
@nx-cloud

nx-cloud Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 17000d9

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 24s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 20s View ↗

☁️ Nx Cloud last updated this comment at 2026-09-25 15:37:21 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 3 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/svelte-query 6.2.4 → 6.2.5 Changeset
@tanstack/svelte-query-devtools 6.2.4 → 6.2.5 Dependent
@tanstack/svelte-query-persist-client 6.2.4 → 6.2.5 Dependent
@tanstack/vue-query-devtools 6.2.4 → 6.2.5 Dependent

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: TanStack/query/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8c28c416-9d3b-45a7-9d2f-07811a9bae95

📥 Commits

Reviewing files that changed from the base of the PR and between 17000d9 and dbb61ec.

📒 Files selected for processing (4)
  • packages/query-persist-client-core/src/__tests__/persist.test.ts
  • packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts
  • packages/vue-query/src/__tests__/useMutation.test.ts

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


📝 Walkthrough

Walkthrough

Test files across TanStack Query packages rename local console.error spy variables to consoleErrorMock. Existing spy setup, assertions, and restoration remain unchanged. One persistence test now spies directly on console.error.

Changes

Console error spy naming

Layer / File(s) Summary
Rename test spies
packages/angular-query-experimental/src/__tests__/with-devtools.test.ts, packages/angular-query-persist-client/src/__tests__/*, packages/preact-query/src/__tests__/*, packages/query-core/src/__tests__/*, packages/query-devtools/src/__tests__/*, packages/query-persist-client-core/src/__tests__/*, packages/react-query-persist-client/src/__tests__/*, packages/react-query/src/__tests__/*, packages/solid-query-persist-client/src/__tests__/*, packages/solid-query/src/__tests__/*, packages/svelte-query-persist-client/tests/*, packages/svelte-query/tests/createQuery/*, packages/vue-query/src/__tests__/*
Test-local console error spies and their assertion and cleanup references use consoleErrorMock. One persistence test now spies on console.error rather than the console object. Tested expectations and behavior are otherwise unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to dbb61

This change renames test-local console error spies without changing their behavior. No material risk to users or test workflows is evident; it is mergeable subject to normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to dbb61

The change affects 13 systems.

Changed systems: packages/preact-query, packages/react-query, packages/query-core, packages/solid-query, packages/query-devtools, packages/angular-query-experimental, packages/angular-query-persist-client, packages/query-persist-client-core, packages/react-query-persist-client, packages/solid-query-persist-client, packages/svelte-query, packages/svelte-query-persist-client, packages/vue-query

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/preact-query (library) was modified; 10 changed files map to changed impact.
  • observed — packages/react-query (library) was modified; 10 changed files map to changed impact.
  • observed — packages/query-core (library) was modified; 5 changed files map to changed impact.
  • observed — packages/solid-query (library) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/angular-query-experimental/src/tests/with-devtools.test.ts: Renamed the local console error spy variable from consoleErrorSpy to consoleErrorMock.
  • observed — Modified behavior in packages/angular-query-experimental/src/tests/with-devtools.test.ts: Updated the missing-QueryClient test to use consoleErrorMock for the existing error-call assertion and spy restoration; the expected log arguments are unchanged.
  • observed — Modified behavior in packages/angular-query-persist-client/src/tests/with-persist-query-client.test.ts: The test now spies specifically on console.error rather than the console object.
  • observed — Modified behavior in packages/angular-query-persist-client/src/tests/with-persist-query-client.test.ts: The test checks that the console.error spy was called once with the restore error, then restores that spy.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 39 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: renaming console.error spies to consoleErrorMock.
Description check ✅ Passed The description includes all template sections, explains the rename scope and unchanged test behavior, and completes the checklist and release-impact section.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: dbb61ec

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.87 KB (0%)
react minimal 8.85 KB (0%)

…rror-spy-to-console-error-mock

# Conflicts:
#	packages/query-persist-client-core/src/__tests__/persist.test.ts
#	packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
#	packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts
@sukvvon
sukvvon merged commit 2443290 into main Sep 25, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/rename-console-error-spy-to-console-error-mock branch September 25, 2026 15:45
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