Skip to content

feat: allow set coverage thresholds as negative number#570

Merged
9aoy merged 1 commit intomainfrom
thresholds-negative
Sep 17, 2025
Merged

feat: allow set coverage thresholds as negative number#570
9aoy merged 1 commit intomainfrom
thresholds-negative

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Sep 17, 2025

Summary

Allow set coverage thresholds as negative number. Thresholds specified as a negative number represent the maximum number of uncovered entities allowed.

import { defineConfig } from '@rstest/core';

export default defineConfig({
  coverage: {
    enabled: true,
    thresholds: {
      lines: -10,
    },
  },
});
Error: Uncovered lines 20 exceeds maximum global threshold allowed 10

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings September 17, 2025 07:15
@netlify
Copy link
Copy Markdown

netlify bot commented Sep 17, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 0c7e1c0
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68ca6018e53271000840e9d4
😎 Deploy Preview https://deploy-preview-570--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 negative coverage thresholds, which represent the maximum number of uncovered entities allowed instead of minimum percentage coverage. This provides an alternative way to specify coverage requirements.

Key Changes:

  • Added documentation explaining negative threshold functionality in both English and Chinese
  • Updated type definitions to support the negative threshold feature
  • Modified test coverage examples and expectations to demonstrate the new functionality

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/docs/zh/config/test/coverage.mdx Added Chinese documentation for negative threshold feature with examples
website/docs/en/config/test/coverage.mdx Added English documentation for negative threshold feature with examples
packages/core/src/types/coverage.ts Added Totals type import and CoverageSummaryTotals export to support implementation
e2e/test-coverage/index.test.ts Updated test expectations to reflect new coverage behavior and added negative threshold test
e2e/test-coverage/fixtures/test/string.test.ts Removed test coverage to create scenario for negative threshold testing
e2e/test-coverage/fixtures/rstest.thresholds.config.ts Added negative lines threshold configuration for testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@9aoy 9aoy merged commit 72ee41c into main Sep 17, 2025
17 checks passed
@9aoy 9aoy deleted the thresholds-negative branch September 17, 2025 07:24
@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