Vitest browser mode migration#43
Merged
Merged
Conversation
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>
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 Agent can help with this pull request. Just |
Member
Author
|
@cursoragent make sure our GitHub action installs Playwright and caches it. Right now CI is failing. Why don't you check the CI? |
|
CI status
Summary
Testing
|
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
| root = null | ||
| container?.remove() | ||
| container = null | ||
| }) |
There was a problem hiding this comment.
Duplicated render helper across browser test files
Medium Severity
The render function, root/container state variables, and afterEach cleanup logic are identically duplicated between the two browser test files. This infrastructure code should be extracted to a shared test utility (e.g., in tests/setup/setup-browser-env.ts or a new tests/browser-test-utils.ts file) and imported where needed.
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 existing tests to Vitest browser mode, removing
@testing-library/{dom,react,user-event}dependencies as requested.Key changes include:
app/routes/_app+/users+/$username.tsxto extract the UI into a newUserProfileViewcomponent, which is now tested in browser mode.app/utils/misc.use-double-check.test.tsxto use Vitest browser APIs.vitest.config.tsto configure separate test projects for Node.js and browser environments.@testing-librarydependencies and related imports.Test Plan
npm run testto execute both Node.js and browser tests and ensure all pass.npm run formatto verify formatting.npm run lintto confirm no linting errors or warnings.Checklist
Screenshots
N/A (No UI changes)
Note
Medium Risk
Introduces a new Playwright-backed Vitest browser test project and adjusts CI to install/cache browsers; risk is mostly around test/CI stability and execution time rather than runtime behavior.
Overview
Migrates
.test.tsxsuites from Testing Library/JSDOM to Vitest browser mode backed by Playwright, including new browser test setup and splitting Vitest intonodevsbrowserprojects invitest.config.ts.Refactors the
/users/:usernameroute to reuse a newUserProfile/UserProfileViewcomponent and adds a browser-mode test for that UI, while removing the previous route-level test.Updates CI to cache and install Playwright browsers for the Vitest job (and adds caching for the Playwright job), removes
@testing-library/*deps and related setup/cleanup, and applies import/type-only ordering tweaks across various files.Written by Cursor Bugbot for commit 82d43f0. This will update automatically on new commits. Configure here.