fix: should exclude test files from coverage collection#559
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements test file exclusion from coverage collection by adding configurable exclude patterns to the coverage options. The changes address a previously unimplemented TODO item to exclude test files from coverage collection.
- Added an
excludeoption to the coverage configuration with default patterns for test files - Updated the coverage plugin to use the exclude patterns with the SWC coverage instrument
- Modified test expectations to reflect the new coverage behavior without test files
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/coverage.ts | Added exclude option type definition with documentation |
| packages/core/src/config.ts | Added default exclude patterns for test files and directories |
| packages/coverage-istanbul/src/plugin.ts | Updated plugin to accept options and pass exclude patterns to SWC |
| e2e/test-coverage/index.test.ts | Updated test expectations to match new coverage behavior |
| e2e/projects/coverage.test.ts | Updated test expectations for projects coverage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/core/src/types/coverage.ts
Outdated
| /** | ||
| * A list of glob patterns that should be excluded from coverage collection. | ||
| * | ||
| * @default ['**\/node_modules/**', '**\/dist/**', '**\/test/**', '**\/__tests__/**', '**\/*.{test,spec}.?(c|m)[jt]s?(x)', '**\/__mocks__/**'] |
There was a problem hiding this comment.
The JSDoc comment has incorrect escaping of forward slashes. The backslashes before forward slashes should be removed as they are not needed in JSDoc comments.
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary
should exclude test files from coverage collection.
Related Links
Checklist