test: refine Istanbul/Vitest coverage exclude globs#2262
Conversation
- Add exclusion for all generated files (*.gen.ts, *.gen.tsx) - Explicitly exclude renderer/src/route-tree.gen.ts (TanStack Router) - Exclude shadcn/ui components (renderer/src/common/components/ui/**) - These are generated/copied from shadcn/ui - Should not be individually tested in this project - Testing them would inflate coverage without value This improves coverage accuracy by excluding code that: 1. Is auto-generated and should not be modified 2. Is third-party UI components not specific to this project Fixes stacklok#596
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 485d865e1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| '**/*.gen.tsx', | ||
| 'renderer/src/route-tree.gen.ts', | ||
| // shadcn/ui components (generated, not project-specific) | ||
| 'renderer/src/common/components/ui/**', |
There was a problem hiding this comment.
Narrow the UI coverage exclusion to generated shadcn files
This blanket exclude hides coverage for every component in renderer/src/common/components/ui, but that directory also contains project-specific code such as file-picker-input.tsx, loading-state-alert.tsx, input-search.tsx, and circular-status-icon.tsx, not just copied shadcn primitives. In coverage runs, bugs or untested branches in those local components will no longer be reflected at all, which makes the coverage report less accurate than before; please exclude only the actual generated shadcn primitives or move custom components out of this excluded path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Refines Vitest coverage exclusions to omit generated code and vendor-copied UI components, aligning coverage reporting with project-owned logic (per #596).
Changes:
- Excludes generated files from coverage via
**/*.gen.ts,**/*.gen.tsx, andrenderer/src/route-tree.gen.ts. - Excludes
renderer/src/common/components/ui/**from coverage to omit shadcn/ui-derived components.
| // shadcn/ui components (generated, not project-specific) | ||
| 'renderer/src/common/components/ui/**', |
Summary
Refines test coverage exclusions to exclude generated files and shadcn/ui components, as requested in #596.
Changes
Added the following exclusions to
vitest.config.tscoverage configuration:1. Generated files
Rationale: These files are auto-generated (e.g., by TanStack Router plugin) and should not be modified or tested directly.
2. shadcn/ui components
Rationale: As mentioned in the issue, shadcn/ui components are generated/copied from the shadcn/ui library and should almost never be individually tested in this project. Testing them would:
Impact
Before
After
Testing
Verification steps
Run tests with coverage:
Verify that coverage report excludes:
renderer/src/route-tree.gen.tsrenderer/src/common/components/ui/*.gen.tsor*.gen.tsxfilesConfirm CI still passes
Expected results
Related
Fixes #596