Migrate test framework from Jest to Vitest#47
Closed
Pearce-Ropion wants to merge 11 commits intomainfrom
Closed
Conversation
Replaces jest, ts-jest, jest-environment-jsdom, and related types with
vitest + jsdom. Test config moves from jest.config.ts to vitest.config.ts
(jsdom environment, globals enabled, same src/**/*.test.{js,jsx,ts,tsx}
glob). The lone test file swaps `jest.fn()`/`jest.resetAllMocks()` for
the equivalent `vi.*` APIs, and tsconfig now references vitest/globals
types.
https://claude.ai/code/session_017ZviPYnLaycC73S9VqYhgf
Drop `globals: true` from vitest.config.ts and remove the `vitest/globals` types entry from tsconfig.json. Test files now explicitly import `describe`, `it`, `expect`, `vi`, and the lifecycle hooks from `vitest`. https://claude.ai/code/session_017ZviPYnLaycC73S9VqYhgf
Swap the jsdom test environment for Vitest's browser mode running Chromium via Playwright. Drops `jsdom`, bumps `vitest` to ^4.1.5, and adds `@vitest/browser-playwright` and `playwright`. Also bumps `@types/node` to ^24 to satisfy vitest 4's peer requirement (matches the .nvmrc). After install, run `npx playwright install chromium` once to fetch the browser binary. https://claude.ai/code/session_017ZviPYnLaycC73S9VqYhgf
Restore `globals: true` in vitest.config.ts and drop the explicit `vitest` imports from test files. The `types` array in tsconfig.json gets `vitest/globals`; it also needs `node` since specifying `types` opts out of automatic @types inclusion. https://claude.ai/code/session_017ZviPYnLaycC73S9VqYhgf
Pearce-Ropion
commented
May 7, 2026
| // send initialize event | ||
| void execPromise( | ||
| 'wb:plugin:init', | ||
| require('../../package.json').version, |
Collaborator
Author
There was a problem hiding this comment.
This version thing is a feature we previously had for plugins that we removed (like 3 years ago) so removing this here shouldn't cause any issues.
It was causing issues with the test environment which is why it is being removed in this PR.
| const searchParams = new URLSearchParams(document.location.search); | ||
|
|
||
| for (const [key, value] of searchParams.entries()) { | ||
| if (value.startsWith('{')) { |
Contributor
There was a problem hiding this comment.
We can't assume that these search params will be objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the project's test framework from Jest to Vitest, modernizing the testing setup while maintaining the same test patterns and coverage.
Key Changes
vitest runandvitestinstead of Jest commandsjest.config.tswithvitest.config.tsusing Vitest'sdefineConfigAPIjest.fn()andjest.resetAllMocks()tovi.fn()andvi.resetAllMocks()in test filesjest,@jest/types,@types/jest,ts-jest,jest-environment-jsdom,jest-watch-typeahead) and addedvitestandjsdomvitest/globalsto the types array and updated include paths to reference the new Vitest config fileImplementation Details
src/**/*.test.{js,jsx,ts,tsx}jsdomfor DOM testingglobals: trueoption in Vitest config, allowing test functions to be used without explicit importshttps://claude.ai/code/session_017ZviPYnLaycC73S9VqYhgf