-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Upgrade to Vitest v4 #9862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Vitest v4 #9862
Conversation
|
📝 WalkthroughWalkthroughUpdates Vite and Vitest dependencies across examples and packages, adds Next.js route type imports, converts React examples to use react-jsx, refines test mock utilities and assertions, and modernizes ESLint configuration. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
TkDodo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome. can you please fix the conflicts and I’ll try to ship it
|
|
||
| expect(queryFn).toHaveBeenCalledOnce() | ||
| expect(queryFn).toHaveBeenCalledWith(context) | ||
| expect(queryFn).toHaveBeenCalledExactlyOnceWith(context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this is a nice new matcher 👍
|
|
||
| afterEach(() => { | ||
| vi.useRealTimers() | ||
| Fallback.mockClear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what’s that doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over from debugging why the test broke on the upgrade. Forgot to remove sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
|
@TkDodo sorry missed these comments will get this fixed tomorrow/day after |
|
@TkDodo Fixed merge conflicts but now one test is failing, need to double check why |
|
@AlexanderKaran trying to fix the pipeline ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 89-93: The pnpm override forcing vite ^6.4.1 conflicts with the
Vue 2 example packages (examples/vue/2.7-basic and examples/vue/2.6-basic) which
require vite ^4.5.14 for vite-plugin-vue2@2.0.3; fix by updating package.json
pnpm.overrides to either (a) add package-specific overrides that pin vite to
^4.5.14 for those two example packages, or (b) exclude those example packages
from the global vite override, or (c) update the example projects to be
compatible with vite ^6.x and replace vite-plugin-vue2 with a compatible plugin;
locate and change the pnpm.overrides entry in package.json and the vite entries
in examples/vue/2.7-basic and examples/vue/2.6-basic to implement one of these
fixes.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
package.json
🔇 Additional comments (1)
package.json (1)
56-57: All Vitest v4/Vite v6 versions are compatible and properly aligned.vitest 4.0.17 supports Vite 5 and 6 (range:
^5.0.0 || ^6.0.0), and the included plugins (@vitest/coverage-istanbul4.0.6,@vitest/eslint-plugin1.4.0) are part of the Vitest 4.x ecosystem. The pnpm overrides for vite, esbuild, and@typespackages are standard workspace management without conflicts.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
the remaining errors are legit I think, can you take another look please? |
|
@TkDodo Digging into it now |
- Fallback UI is not reset between tests -> moved to create a function for each - ruleTests needs to be top level
|
@TkDodo Did some tweaks and running test locally is now passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@examples/react/simple/package.json`:
- Around line 17-19: Update the `@vitejs/plugin-react` dependency in package.json
from "@vitejs/plugin-react": "^4.3.4" to a v5+ range (for example "^5.0.0" or
"^5.x") so it is compatible with Vite 6.4.1; locate the dependency entry for
"@vitejs/plugin-react" and bump the version string, then run install and verify
the dev server/tests (Vite and Vitest) start correctly.
In `@examples/svelte/ssr/package.json`:
- Line 21: Update the vite dependency in package.json to pin it to Vite 5 for
SvelteKit 2.42 compatibility: replace the current "vite": "^6.4.1" entry with a
Vite 5.x range (e.g. "vite": "^5.x") so the project uses a supported peer
version; ensure package.json's "vite" key is updated and run an install to lock
the new version.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9862 +/- ##
==========================================
- Coverage 46.05% 36.86% -9.19%
==========================================
Files 200 245 +45
Lines 8542 11102 +2560
Branches 1976 2079 +103
==========================================
+ Hits 3934 4093 +159
- Misses 4150 6484 +2334
- Partials 458 525 +67 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@integrations/react-vite/package.json`:
- Around line 11-14: Update package.json to move the build tooling packages from
dependencies to devDependencies: remove "@vitejs/plugin-react" and "vite" from
the "dependencies" section and add them under "devDependencies" (keeping their
existing versions), leaving runtime packages like "react" and "react-dom" in
dependencies; ensure package.json remains valid JSON and run an install to
update lockfile if present.
|
Thank you, great work 🎉 |
🎯 Changes
Upgrade TanStack Query to use Vitest 4. Most changes were around mocks, testing functions being used and some config tweaks.
A few gotchas I am unsure about:
Please let me know if I have messed with things that should not be touched.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Release Notes
Chores
Tests
✏️ Tip: You can customize this high-level summary in your review settings.