Skip to content

Vitest 4.0 manual matcher types#10

Closed
kentcdodds wants to merge 11 commits intomainfrom
cursor/vitest-4-0-manual-matcher-types-e9b2
Closed

Vitest 4.0 manual matcher types#10
kentcdodds wants to merge 11 commits intomainfrom
cursor/vitest-4-0-manual-matcher-types-e9b2

Conversation

@kentcdodds
Copy link
Member

@kentcdodds kentcdodds commented Jan 20, 2026

Update Vitest to v4.0 and remove manual matcher type imports.

Vitest v4.0 automatically includes browser matcher types via @vitest/browser/context, making explicit imports like @vitest/browser/matchers unnecessary. This PR updates Vitest and related browser dependencies to v4.0.17 and adjusts the TypeScript configuration and vite.config.ts files accordingly.


Open in Cursor Open in Web


Note

Upgrade and config migration

  • Bumps vitest and @vitest/browser to ^4.0.17 across exercises; adds @vitest/browser-playwright; updates root to include vitest
  • Switches vite config refs to /// <reference types="vitest/config" /> and configures Playwright via import { playwright } from '@vitest/browser-playwright' with provider: playwright()
  • Replaces manual matcher/provider types with "types": ["vitest/globals", "@vitest/browser/context"] in tsconfig.*.json

Docs and examples

  • Updates READMEs to reflect Vitest v4 changes (use of browser context types, Playwright provider) and terminology shift from "workspaces" to "projects"
  • Minor code tweaks (e.g., import.meta.env.DEV, setup file guidance) to align with new browser mode setup

Written by Cursor Bugbot for commit ea9e836. This will update automatically on new commits. Configure here.

cursoragent and others added 10 commits January 20, 2026 20:48
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
@cursor
Copy link

cursor bot commented Jan 20, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kentcdodds
Copy link
Member Author

@kettanaito feel free to close this if it's not helpful. My prompt was:

Could you solve this: Vitest 4.0: Remove manual matcher types #9 #9

It did a lot more work than I expected, but upgrading to vitest 4 apparently required a bit more work than I expected.

@kentcdodds
Copy link
Member Author

Problem is I think some of these changes would require video changes. Either that or you could add callouts in some key places to explain differences in the videos until you get around to updating them.

@kentcdodds kentcdodds marked this pull request as ready for review January 20, 2026 23:10
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

@cursor
Copy link

cursor bot commented Jan 20, 2026

Bugbot Autofix resolved the bug found in the latest run.

  • ✅ Fixed: Testing library incorrectly placed in production dependencies
    • Moved @vitest/browser from dependencies to devDependencies in both exercise 01 package.json files to match the pattern used in all other exercises.

@kettanaito
Copy link
Member

@kentcdodds, shouldn't we leave the dependencies frozen though? As you pointed out, some updates will have to be reflected in the videos, for which I don't have the time at the moment.

I don't see workshops are guidebooks on particular tools. For example, whether we're using Vitest 3.0 or 4.0 is irrelevant to the topic of the workshop, that being in-browser component testing.

#9 I had was meant only for the Extras, not for the entire workshop. I have a designated extra materials that walk the students through 3.0 -> 4.0 migration without invalidating anything they've learned prior to that.

I'm going to close this!

@kettanaito
Copy link
Member

Fixed it in #11.

@kentcdodds
Copy link
Member Author

Ah perfect 👍👍

Love seeing you use that feature already!

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.

3 participants

Comments