Summary
The Karmada Dashboard frontend (under ui/) currently has no unit test setup. I'd like to propose adding Vitest + React Testing Library for component-level unit testing.
Why this matters
- The
ui/ directory has grown with React + TypeScript components but has zero automated test coverage
- Vitest is the standard testing tool for Vite-based projects (which this project uses)
- Unit tests would help catch regressions in core UI components like cluster management, policy views, etc.
- This is a commonly requested improvement in CNCF dashboard projects
What I propose to do
- Add `vitest, @testing-library/react, @testing-library/jest-dom, and jsdom as dev dependencies
- Configure Vitest inside the existing
vite.config.ts
- Create a
src/test/setup.ts setup file
- Write initial unit tests for 2–3 core components (e.g. login page, cluster list, navigation)
- Add a
"test" script to package.json
Scope
This is frontend-only and does not touch the Go backend. The goal is to establish a baseline test setup so future contributors can add tests alongside new components.
Question for maintainers
Are you open to this? If yes, are there specific components you'd like tested first, or any conventions I should follow?
Summary
The Karmada Dashboard frontend (under
ui/) currently has no unit test setup. I'd like to propose adding Vitest + React Testing Library for component-level unit testing.Why this matters
ui/directory has grown with React + TypeScript components but has zero automated test coverageWhat I propose to do
vite.config.tssrc/test/setup.tssetup file"test"script topackage.jsonScope
This is frontend-only and does not touch the Go backend. The goal is to establish a baseline test setup so future contributors can add tests alongside new components.
Question for maintainers
Are you open to this? If yes, are there specific components you'd like tested first, or any conventions I should follow?