Skip to content

test(solid-query-devtools/devtools{,Panel}): add tests for the non-development fallback#10848

Merged
sukvvon merged 1 commit into
mainfrom
test/solid-query-devtools-non-development-fallback
May 31, 2026
Merged

test(solid-query-devtools/devtools{,Panel}): add tests for the non-development fallback#10848
sukvvon merged 1 commit into
mainfrom
test/solid-query-devtools-non-development-fallback

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 31, 2026

🎯 Changes

Add a non-development fallback test case to both SolidQueryDevtools and SolidQueryDevtoolsPanel, mirroring the matrix that already exists for the React, Preact, and Vue adapters.

Unlike React/Preact/Vue, Solid does not switch on process.env.NODE_ENV. The index.tsx of @tanstack/solid-query-devtools reads isDev from solid-js/web, which is a build-time constant, so the usual vi.stubEnv('NODE_ENV', 'production') approach has no effect here. The new case swaps isDev to false via per-test vi.doMock('solid-js/web', ...) and dynamically imports the module to exercise the fallback branch.

✅ 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 test coverage ensuring devtools UI and panel remain disabled (return null) when the runtime reports a non-development environment, including safeguards to avoid test cross-contamination.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

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

Run ID: b7b7cbbf-9fb0-4c9e-a5f5-10cbf4c836d8

📥 Commits

Reviewing files that changed from the base of the PR and between 52e1b7f and 6962c9e.

📒 Files selected for processing (2)
  • packages/solid-query-devtools/src/__tests__/devtools.test.tsx
  • packages/solid-query-devtools/src/__tests__/devtoolsPanel.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/solid-query-devtools/src/tests/devtools.test.tsx
  • packages/solid-query-devtools/src/tests/devtoolsPanel.test.tsx

📝 Walkthrough

Walkthrough

The PR adds two Vitest tests that assert SolidQueryDevtools and SolidQueryDevtoolsPanel return null when solid-js/web reports isDev: false. Each test mocks solid-js/web, resets modules, dynamically imports the module, asserts the null result, and cleans up in a finally block.

Changes

Production environment null-return tests

Layer / File(s) Summary
Production environment null-return tests
packages/solid-query-devtools/src/__tests__/devtools.test.tsx, packages/solid-query-devtools/src/__tests__/devtoolsPanel.test.tsx
Added two tests that mock isDev: false and verify SolidQueryDevtools and SolidQueryDevtoolsPanel return null. Tests reset modules, dynamically import the modules to pick up mocks, assert null, and restore module state in finally blocks.

Possibly related PRs

  • TanStack/query#10827: Extends devtoolsPanel.test.tsx with additional test coverage for prop wiring, default fallbacks, and unmount behavior.

Poem

🐰 In tests I hop, mock set to false,
I reset the world, import with a pulse.
The factory wakes, then sleeps with a lull—
Production is quiet, the devtools are null. 🥕🐇

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding tests for the non-development fallback in solid-query-devtools for both devtools and devtoolsPanel modules.
Description check ✅ Passed The description follows the template structure, explains the changes and their motivation, includes completed checklist items, and correctly identifies the release impact as dev-only.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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/solid-query-devtools-non-development-fallback

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

@sukvvon sukvvon self-assigned this May 31, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 31, 2026

View your CI Pipeline Execution ↗ for commit 52e1b7f

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

☁️ Nx Cloud last updated this comment at 2026-05-31 18:25:55 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.6 → 0.2.7 Changeset
@tanstack/query-devtools 5.100.14 → 5.100.15 Changeset
@tanstack/angular-query-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/angular-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/eslint-plugin-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/query-async-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/query-broadcast-client-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/query-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-persist-client-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-sync-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/react-query 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-next-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/svelte-query 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-devtools 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-persist-client 6.1.33 → 6.1.34 Dependent
@tanstack/vue-query 5.100.14 → 5.100.15 Dependent
@tanstack/vue-query-devtools 6.1.33 → 6.1.34 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 31, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 6962c9e

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2026

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon changed the title test(solid-query-devtools/devtools{,Panel}): add a non-development fallback case test(solid-query-devtools/devtools{,Panel}): add tests for the non-development fallback May 31, 2026
@sukvvon sukvvon force-pushed the test/solid-query-devtools-non-development-fallback branch from 52e1b7f to 6962c9e Compare May 31, 2026 18:24
@sukvvon sukvvon merged commit 9d488a1 into main May 31, 2026
9 checks passed
@sukvvon sukvvon deleted the test/solid-query-devtools-non-development-fallback branch May 31, 2026 18:26
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