Add Vitest testing framework with React Testing Library#26
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
Add Vitest testing framework with React Testing Library#26devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add Vitest, @testing-library/react, @testing-library/dom, and jsdom - Create vitest.config.mjs with JSX support for .js files - Add test setup file with jest-dom matchers - Add unit tests for AppFooter component (5 tests) - Add unit tests for Redux store (5 tests) - All 10 tests pass successfully
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:
|
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 adds a unit testing framework to the CoreUI React Admin Template, which previously had no testing infrastructure. The setup includes Vitest as the test runner with React Testing Library for component testing.
Key additions:
.jsfilesReview & Testing Checklist for Human
Verify dependency installation: Dependencies were installed with
--legacy-peer-depsdue to React 19 compatibility. Runnpm install --legacy-peer-depsand confirm no runtime errors occur when runningnpm testCheck store test isolation: The Redux store tests in
src/store.test.jsdispatch actions that mutate global state. Tests may be order-dependent - verify tests pass when run individually and in different ordersValidate JSX loader config: The
vitest.config.mjsincludes a workaround to treat.jsfiles as JSX (lines 6-16). Confirm this doesn't cause issues with non-JSX.jsfiles in the projectRecommended test plan:
npm install --legacy-peer-depsnpm testand verify all 10 tests passnpm run test:coverageto check coverage reporting worksnpm run buildto ensure the new dev dependencies don't affect production buildsNotes
Link to Devin run: https://partner-workshops.devinenterprise.com/sessions/b313c50a7c6e4ec8b18a4fb7f65c1508