Skip to content

Add Vitest testing framework with React Testing Library#26

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1770119351-add-vitest-testing
Closed

Add Vitest testing framework with React Testing Library#26
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1770119351-add-vitest-testing

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Feb 3, 2026

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:

  • Vitest configuration with jsdom environment and JSX support for .js files
  • Test setup with jest-dom matchers for DOM assertions
  • 10 unit tests across 2 test files (AppFooter component and Redux store)

Review & Testing Checklist for Human

  • Verify dependency installation: Dependencies were installed with --legacy-peer-deps due to React 19 compatibility. Run npm install --legacy-peer-deps and confirm no runtime errors occur when running npm test

  • Check store test isolation: The Redux store tests in src/store.test.js dispatch actions that mutate global state. Tests may be order-dependent - verify tests pass when run individually and in different orders

  • Validate JSX loader config: The vitest.config.mjs includes a workaround to treat .js files as JSX (lines 6-16). Confirm this doesn't cause issues with non-JSX .js files in the project

Recommended test plan:

  1. Run npm install --legacy-peer-deps
  2. Run npm test and verify all 10 tests pass
  3. Run npm run test:coverage to check coverage reporting works
  4. Optionally run npm run build to ensure the new dev dependencies don't affect production builds

Notes

Link to Devin run: https://partner-workshops.devinenterprise.com/sessions/b313c50a7c6e4ec8b18a4fb7f65c1508

- 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
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot deleted the devin/1770119351-add-vitest-testing branch April 24, 2026 22:03
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.

0 participants