Failure thresholds mtp - #2019
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds coverage failure-threshold support to the coverlet.MTP extension, aligning it with existing threshold behavior in other Coverlet drivers, and updates the MTP integration documentation and tests accordingly.
Changes:
- Introduces threshold settings (
Threshold,ThresholdType,ThresholdStat) in MTP settings/config parsing and exposes them via command-line options. - Adds threshold evaluation/output in the collector and sets a non-zero exit code when thresholds are not met.
- Updates MTP docs and adds/extends unit tests around parsing/validation and threshold reporting.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| test/coverlet.MTP.tests/Configuration/CoverletMTPSettingsTests.cs | Extends settings default/to-string tests for threshold fields. |
| test/coverlet.MTP.tests/Configuration/CoverletMTPSettingsParserTests.cs | Adds config parsing test coverage for threshold settings. |
| test/coverlet.MTP.tests/CommandLine/CoverletMTPCommandLineTests.cs | Adds validation tests for new threshold-related CLI options. |
| test/coverlet.MTP.tests/Collector/CollectorExtensionThresholdTests.cs | New tests verifying threshold summary output formatting. |
| src/coverlet.MTP/Configuration/CoverletMTPSettingsParser.cs | Parses threshold-related settings from configuration. |
| src/coverlet.MTP/Configuration/CoverletMTPSettings.cs | Adds threshold fields to settings and includes them in ToString output. |
| src/coverlet.MTP/Configuration/CoverletMTPConstants.cs | Adds config keys/defaults for threshold settings. |
| src/coverlet.MTP/Configuration/CoverletExtensionConfiguration.cs | Adds threshold fields to collector configuration model. |
| src/coverlet.MTP/Configuration/CoverageConfiguration.cs | Adds threshold getters that unify CLI vs config sources. |
| src/coverlet.MTP/CommandLine/CoverletOptionNames.cs | Defines option names for threshold-related CLI options. |
| src/coverlet.MTP/CommandLine/CoverletExtensionCommandLineProvider.cs | Validates threshold CLI arguments (range, enum values, coverage types). |
| src/coverlet.MTP/CommandLine/CoverletCommandLineOptionDefinitions.cs | Registers threshold CLI options and their arities/descriptions. |
| src/coverlet.MTP/Collector/CollectorExtension.cs | Implements threshold evaluation, reporting, and exit code behavior. |
| global.json | Updates pinned .NET SDK version. |
| Documentation/DriversFeatures.md | Updates feature matrix for MTP threshold support (and .NET Framework support). |
| Documentation/Coverlet.MTP.Integration.md | Documents threshold CLI/config options and updates configuration tables. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Add CoverletCoverageDataProducer for MTP message creation/publishing - CollectorExtension now publishes coverage, threshold, and report messages to IMessageBus - Refactor exit code logic for threshold failures - Update CollectorExtensionProvider for DI of message bus and producer - Refactor and add tests for message-based reporting and producer logic - Update integration test for new summary output - Bump MicrosoftTestingPlatformVersion to 2.4.0 - Update .github/copilot-instructions.md for test/code standards and netstandard2.0 rules
The code now computes and reports method coverage alongside line and branch coverage. It introduces overall and per-module method coverage metrics using CoverageSummary.CalculateMethodCoverage, and includes these in the TestCoverageMessage output. Method coverage is now always calculated and reported, independent of threshold configuration.
0665186 to
a4c5900
Compare
7613e5c to
bf6f4cd
Compare
Update global.json SDK to 10.0.401 and introduce $(MicrosoftNetRuntimeVersion) property set to 10.0.12. Replace hardcoded Microsoft.Extensions.* and System.* package versions in project files with the new property. Bump Microsoft.CodeAnalysis to 5.9.0, Microsoft.NET.Test.Sdk to 18.9.0, and xunit.runner.visualstudio to 4.0.0. Update net9.0-specific dependencies in coverlet.core.csproj to 9.0.20 and System.Text.Json in coverlet.integration.template.csproj to 10.0.12. Align conditional references in coverlet.integration.tests.csproj to use the new runtime version property.
There was a problem hiding this comment.
🟡 Changes recommended
It includes a functional bug in report-format publishing (cobertura/opencover are misidentified), plus documentation inconsistencies and missing unit tests for the new exit-code enforcement behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 41/41 changed files
- Comments generated: 5
- Review effort level: Lite
coverlet.core(also used forcoverlet.console,coverlet.msbuild)