Skip to content

Add --coverlet-file-prefix option for unique report files#1869

Merged
Bertk merged 8 commits intocoverlet-coverage:masterfrom
Bertk:prefix-option
Mar 27, 2026
Merged

Add --coverlet-file-prefix option for unique report files#1869
Bertk merged 8 commits intocoverlet-coverage:masterfrom
Bertk:prefix-option

Conversation

@Bertk
Copy link
Copy Markdown
Collaborator

@Bertk Bertk commented Mar 27, 2026

Introduce --coverlet-file-prefix to allow custom prefixes for coverage report filenames, preventing overwrites in multi-project test runs. Updated documentation, command-line parsing, configuration, and report generation logic to support the new option. Added comprehensive unit tests for filename generation and option handling. Improves usability in CI and multi-project scenarios.

Introduce --coverlet-file-prefix to allow custom prefixes for coverage report filenames, preventing overwrites in multi-project test runs. Updated documentation, command-line parsing, configuration, and report generation logic to support the new option. Added comprehensive unit tests for filename generation and option handling. Improves usability in CI and multi-project scenarios.
Copilot AI review requested due to automatic review settings March 27, 2026 08:56
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

Adds a new --coverlet-file-prefix CLI option to help generate unique coverage report filenames (avoiding overwrites) during multi-project test runs in coverlet.MTP.

Changes:

  • Introduces coverlet-file-prefix option name/definition and threads it through configuration into report generation.
  • Updates report filename generation to optionally use <prefix>.coverage.<extension>.
  • Adds documentation and unit tests around option handling and filename generation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/coverlet.MTP.tests/Configuration/CoverageConfigurationTests.cs Adds unit tests for CoverageConfiguration.GetFilePrefix() behavior.
test/coverlet.MTP.tests/CommandLine/CoverletMTPCommandLineTests.cs Verifies the new option is exposed and treated as valid with a value.
test/coverlet.MTP.tests/Collector/CollectorExtensionTests.GenerateReports.cs Adds tests asserting prefixed/unprefixed report filenames across formats.
src/coverlet.MTP/Configuration/CoverletExtensionConfiguration.cs Adds FilePrefix to the extension configuration object.
src/coverlet.MTP/Configuration/CoverageConfiguration.cs Adds GetFilePrefix() to read the option value from CLI args.
src/coverlet.MTP/CommandLine/CoverletOptionNames.cs Defines the coverlet-file-prefix option name constant.
src/coverlet.MTP/CommandLine/CoverletCommandLineOptionDefinitions.cs Registers the new command-line option definition.
src/coverlet.MTP/Collector/CollectorExtension.cs Wires the prefix into configuration and uses it in report file naming.
Documentation/Coverlet.MTP.Integration.md Documents the new option and shows example usage/output naming.

Comment thread src/coverlet.MTP/Collector/CollectorExtension.cs Outdated
Comment thread src/coverlet.MTP/Configuration/CoverageConfiguration.cs Outdated
Comment thread test/coverlet.MTP.tests/CommandLine/CoverletMTPCommandLineTests.cs
@Bertk Bertk added enhancement General enhancement request driver-MTP Issue related to Microsoft Testing Platform driver labels Mar 27, 2026
Add robust validation and sanitization for the filePrefix option used in coverage report filenames to prevent path traversal and invalid characters. Update CollectorExtension and command-line provider to reject unsafe prefixes and fall back to defaults when necessary. Improve CoverageConfiguration to trim and validate prefixes. Add comprehensive unit tests to verify correct and secure behavior.
Bertk added 6 commits March 27, 2026 16:57
Added unit tests to ensure coverage report file prefixes with
invalid characters or whitespace fall back to default filenames.
Also tested command-line prefix validation for invalid and
potentially unsafe values. Improves robustness and security
of file naming logic.
This was referenced Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver-MTP Issue related to Microsoft Testing Platform driver enhancement General enhancement request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants