Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for coverage threshold checking to ensure code coverage meets specified criteria. The feature allows users to define minimum coverage percentages for statements, functions, branches, and lines, and fails the test run if thresholds are not met.
- Adds a new
CoverageThresholdstype to define minimum coverage percentages - Integrates threshold checking into the test runner with appropriate error handling
- Updates test utilities to support regex matching for error message validation
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/coverage.ts | Defines the CoverageThresholds type and adds it to CoverageOptions |
| packages/core/src/core/runTests.ts | Implements threshold checking logic after coverage collection |
| e2e/test-coverage/index.test.ts | Adds end-to-end test for threshold validation functionality |
| e2e/test-coverage/fixtures/rstest.thresholds.config.ts | Test configuration file with threshold settings |
| e2e/scripts/index.ts | Updates expectLog utility to support regex pattern matching |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const { checkThresholds } = await import( | ||
| '../coverage/checkThresholds' | ||
| ); |
There was a problem hiding this comment.
Dynamic import of '../coverage/checkThresholds' may fail if the module doesn't exist. The checkThresholds module is being imported but not defined in the changes shown, which could cause a runtime error.
| const { checkThresholds } = await import( | |
| '../coverage/checkThresholds' | |
| ); | |
| let checkThresholds; | |
| try { | |
| ({ checkThresholds } = await import( | |
| '../coverage/checkThresholds' | |
| )); | |
| } catch (importErr) { | |
| logger.error( | |
| "Coverage thresholds are configured, but '../coverage/checkThresholds' module could not be loaded. Please ensure it exists.", | |
| importErr | |
| ); | |
| process.exitCode = 1; | |
| return; | |
| } |
Summary
support check coverage thresholds.
Related Links
Checklist