-
-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Copy link
Description
What problem does this feature solve?
Rstest's current default behavior for coverage collection differs from both Jest and Vitest when it comes to files outside the project root (e.g., modules from sibling workspace packages in a monorepo).
Current behavior comparison:
| Framework | Default behavior | External coverage control |
|---|---|---|
| Jest | External files excluded | No built-in option |
| Vitest | External files excluded | coverage.allowExternal (default false) |
| Rstest (current) | External files included | No option available |
This default-on behavior is inconsistent with the ecosystem convention (both Jest and Vitest default to excluding external files). It can also produce noisy reports that include coverage for node_modules symlinked packages or unrelated workspace dependencies that the user doesn't intend to track.
Referenced from: #85 (comment)
What does the proposed API look like?
We should align with the Jest/Vitest default (exclude external files), and provide an option for users who need cross-package coverage in monorepo setups.
// rstest.config.ts
import { defineConfig } from '@rstest/core';
export default defineConfig({
coverage: {
enabled: true,
// Allow coverage collection for files outside the project root
allowExternal: true, // default: false
},
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels