Skip to content

feat: support check coverage thresholds#560

Merged
9aoy merged 1 commit intomainfrom
coverageThresholds
Sep 15, 2025
Merged

feat: support check coverage thresholds#560
9aoy merged 1 commit intomainfrom
coverageThresholds

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Sep 12, 2025

Summary

support check coverage thresholds.

image

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings September 12, 2025 10:23
@netlify
Copy link
Copy Markdown

netlify bot commented Sep 12, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit c023484
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68c3f4b087f5630008558672
😎 Deploy Preview https://deploy-preview-560--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CoverageThresholds type 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.

Comment on lines +290 to +292
const { checkThresholds } = await import(
'../coverage/checkThresholds'
);
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 0005e5a into main Sep 15, 2025
17 checks passed
@9aoy 9aoy deleted the coverageThresholds branch September 15, 2025 03:33
@9aoy 9aoy mentioned this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants