Migrate testing infrastructure from Jest (CRA) to Vitest#12
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Migrate testing infrastructure from Jest (CRA) to Vitest#12devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Remove old testing libraries (@testing-library/react ^12, jest-dom ^5, user-event ^13) - Install vitest, jsdom, @testing-library/react ^16, jest-dom ^6, user-event ^14, @vitejs/plugin-react - Create vitest.config.js with path aliases, jsdom environment, and JSX-in-JS support - Add react-dom/client compatibility shim for React 17 - Update setupTests.js (remove CRA comments) - Update package.json test script to use vitest - Fix App.test.jsx to render with AlertProvider context Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
5 tasks
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
Migrates the testing infrastructure from Jest (via Create React App) to Vitest (Session C of 4-session parallel migration).
Changes:
@testing-library/react(^12),@testing-library/jest-dom(^5),@testing-library/user-event(^13)vitest(^2),jsdom,@vitejs/plugin-react(^4)@testing-library/react(^16),@testing-library/jest-dom(^6),@testing-library/user-event(^14)@testing-library/dom(peer dependency of @testing-library/react v16)vitest.config.jswith:.jsfiles (CRA convention)react-dom/clientalias to a compatibility shim for React 17src/test/react-dom-client-shim.js— bridges@testing-library/reactv16's dependency onreact-dom/client(React 18 API) to work with React 17'sReactDOM.render. Can be removed once React is upgraded to v18+.src/setupTests.js— removed CRA boilerplate commentspackage.jsontest script:"test": "vitest"src/App.test.jsx— replaced broken "learn react" test with a "renders without crashing" test wrapped inAlertProvidercontextNote on version compatibility
@testing-library/reactv16 requires React 18+, but this project currently uses React 17. Areact-dom/clientshim is provided to bridge this gap. Once React is upgraded to v18+ (potentially via another parallel migration session), the shim file and thereact-dom/clientalias invitest.config.jscan be removed.Review & Testing Checklist for Human
npx vitest runto verify the test passesreact-dom/clientshim adequately bridges React 17 ↔ @testing-library/react v16vitest.config.jsmatch the project's import conventionspackage.jsonNotes
.jsfiles, which is a CRA convention used throughout this codebase.--legacy-peer-depswas required during install due to the React 17 / @testing-library/react v16 peer dependency mismatch.Link to Devin session: https://app.devin.ai/sessions/a59ac023896c4ff68a1e13d94f593e3e
Requested by: @shahmir-masood
Devin Review