Skip to content

fix(tests): disable local coverage instrumentation#10776

Merged
TkDodo merged 2 commits into
TanStack:mainfrom
raashish1601:fix/vitest-coverage-debugging
May 26, 2026
Merged

fix(tests): disable local coverage instrumentation#10776
TkDodo merged 2 commits into
TanStack:mainfrom
raashish1601:fix/vitest-coverage-debugging

Conversation

@raashish1601
Copy link
Copy Markdown
Contributor

@raashish1601 raashish1601 commented May 24, 2026

Fixes #7757.

Summary

  • keep Vitest coverage instrumentation disabled for local package test runs unless CI is set
  • preserve Istanbul coverage collection for CI runs across package vite.config.ts files
  • apply the existing import-order rule to the touched Preact package configs so root lint passes on the edited files

Validation

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm exec prettier --check $(git diff --name-only -- 'packages/*/vite.config.ts')
  • node --max-old-space-size=8192 node_modules/eslint/bin/eslint.js --concurrency=off -c eslint.config.js $(git diff --name-only -- 'packages/*/vite.config.ts')
  • corepack pnpm --filter @tanstack/eslint-plugin-query exec vitest run src/__tests__/test-utils.test.ts
  • CI=true corepack pnpm exec vitest run src/__tests__/test-utils.test.ts --coverage.reporter=text from packages/eslint-plugin-query
  • git diff --check

Note: pnpm --filter @tanstack/eslint-plugin-query run test:eslint fails in this Windows checkout before linting because packages/eslint-plugin-query/root.eslint.config.js is materialized as the symlink target text (../../eslint.config.js). I used the root ESLint config directly for the touched files instead.

Summary by CodeRabbit

  • Chores
    • Configured test coverage collection to run only in CI environments instead of during local testing.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 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: 72f2c331-4b6e-47fb-b2ce-ef0d3569dd5b

📥 Commits

Reviewing files that changed from the base of the PR and between 3042860 and 87e42b8.

📒 Files selected for processing (24)
  • packages/angular-query-experimental/vite.config.ts
  • packages/angular-query-persist-client/vite.config.ts
  • packages/eslint-plugin-query/vite.config.ts
  • packages/preact-query-devtools/vite.config.ts
  • packages/preact-query-persist-client/vite.config.ts
  • packages/preact-query/vite.config.ts
  • packages/query-async-storage-persister/vite.config.ts
  • packages/query-broadcast-client-experimental/vite.config.ts
  • packages/query-codemods/vite.config.ts
  • packages/query-core/vite.config.ts
  • packages/query-devtools/vite.config.ts
  • packages/query-persist-client-core/vite.config.ts
  • packages/query-sync-storage-persister/vite.config.ts
  • packages/query-test-utils/vite.config.ts
  • packages/react-query-devtools/vite.config.ts
  • packages/react-query-persist-client/vite.config.ts
  • packages/react-query/vite.config.ts
  • packages/solid-query-devtools/vite.config.ts
  • packages/solid-query-persist-client/vite.config.ts
  • packages/solid-query/vite.config.ts
  • packages/svelte-query-devtools/vite.config.ts
  • packages/svelte-query/vite.config.ts
  • packages/vue-query-devtools/vite.config.ts
  • packages/vue-query/vite.config.ts

📝 Walkthrough

Walkthrough

Code coverage instrumentation is made conditional on CI environment variables across 27 Vite configuration files in internal packages, changing test.coverage.enabled from true to !!process.env.CI. Three Preact packages also reorder imports, and two packages expand coverage configuration blocks while applying the same change.

Changes

Coverage conditionally enabled in CI

Layer / File(s) Summary
Standard coverage flag updates
packages/angular-query-experimental/vite.config.ts, packages/angular-query-persist-client/vite.config.ts, packages/eslint-plugin-query/vite.config.ts, packages/query-async-storage-persister/vite.config.ts, packages/query-broadcast-client-experimental/vite.config.ts, packages/query-codemods/vite.config.ts, packages/query-core/vite.config.ts, packages/query-devtools/vite.config.ts, packages/query-persist-client-core/vite.config.ts, packages/query-sync-storage-persister/vite.config.ts, packages/react-query-devtools/vite.config.ts, packages/react-query-persist-client/vite.config.ts, packages/react-query/vite.config.ts, packages/solid-query-devtools/vite.config.ts, packages/solid-query-persist-client/vite.config.ts, packages/solid-query/vite.config.ts, packages/svelte-query-devtools/vite.config.ts, packages/vue-query-devtools/vite.config.ts, packages/vue-query/vite.config.ts
test.coverage.enabled is changed from true to !!process.env.CI, disabling Istanbul instrumentation during local development to preserve accurate debugger breakpoints.
Preact packages: import reordering with coverage updates
packages/preact-query-devtools/vite.config.ts, packages/preact-query-persist-client/vite.config.ts, packages/preact-query/vite.config.ts
Import statements are reordered so package.json is imported before the vite type imports, and test.coverage.enabled is updated to !!process.env.CI.
Expanded coverage configuration blocks
packages/query-test-utils/vite.config.ts, packages/svelte-query/vite.config.ts
test.coverage configuration is restructured from inline to explicit multi-line form with enabled: !!process.env.CI, while preserving Istanbul provider and source inclusion patterns.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 Code coverage now respects the CI realm,
No more debug breakpoints that feel surreal.
Istanbul sleeps when devs are near,
But wakes right up when CI draws clear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(tests): disable local coverage instrumentation' directly describes the main change across all modified vite.config.ts files, which disable Vitest coverage for local runs.
Description check ✅ Passed The PR description provides a clear summary of changes, references the linked issue #7757, includes validation steps, and explains the intent and scope of modifications across package configs.
Linked Issues check ✅ Passed The PR successfully addresses issue #7757 by disabling coverage instrumentation locally (via !!process.env.CI) while preserving CI coverage, which resolves the unbound breakpoints problem caused by Istanbul coverage interference.
Out of Scope Changes check ✅ Passed All changes are scoped to disabling local coverage instrumentation in vite.config.ts files and fixing import order in Preact configs per ESLint rules, with no unrelated modifications detected.
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 unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 26, 2026

View your CI Pipeline Execution ↗ for commit e48921b

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

☁️ Nx Cloud last updated this comment at 2026-05-26 13:53:28 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 26, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: e48921b

@TkDodo TkDodo merged commit 532bb29 into TanStack:main May 26, 2026
9 of 14 checks passed
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.

the coverage in vite.config.ts causes unbound breakpoints when debugging internal packages

2 participants