You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add --coverlet-file-prefix option for unique report files
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.
|`--coverlet`| Enable code coverage data collection. |
80
80
|`--coverlet-output-format <format>`| Output format(s) for coverage report. Supported formats: `json`, `lcov`, `opencover`, `cobertura`, `teamcity`. Can be specified multiple times. (default: `json`, `cobertura`) |
81
+
|`--coverlet-file-prefix <prefix>`| Prefix for coverage report filenames to prevent overwrites when multiple test projects write to the same directory. When specified, files are named `<prefix>.coverage.<extension>` instead of `coverage.<extension>`. (default: `none`) |
81
82
|`--coverlet-include <filter>`| Include assemblies matching filters (e.g., `[Assembly]Type`). Can be specified multiple times. (default: `none`) |
82
83
|`--coverlet-include-directory <path>`| Include additional directories for sources. Can be specified multiple times. (default: `none`) |
83
84
|`--coverlet-exclude <filter>`| Exclude assemblies matching filters (e.g., `[Assembly]Type`). Can be specified multiple times. User-specified filters are merged with defaults. (default: `[coverlet.*]*`, `[xunit.*]*`, `[NUnit3.*]*`, `[nunit.*]*`, `[Microsoft.Testing.*]*`, `[Microsoft.Testplatform.*]*`, `[Microsoft.VisualStudio.TestPlatform.*]*`) |
This generates files named `MyProject.UnitTests.coverage.json` and `MyProject.UnitTests.coverage.cobertura.xml` instead of overwriting the default `coverage.json` and `coverage.cobertura.xml`.
203
+
195
204
## Coverage Output
196
205
197
206
Coverlet can generate coverage results in multiple formats:
Copy file name to clipboardExpand all lines: src/coverlet.MTP/CommandLine/CoverletCommandLineOptionDefinitions.cs
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ public static IReadOnlyCollection<CommandLineOption> GetAllOptions()
19
19
[
20
20
newCommandLineOption(CoverletOptionNames.Coverage,"Enable code coverage data collection.",ArgumentArity.Zero,isHidden:false),
21
21
newCommandLineOption(CoverletOptionNames.Formats,"Output format(s) for coverage report (json, lcov, opencover, cobertura).",ArgumentArity.OneOrMore,isHidden:false),
22
+
newCommandLineOption(CoverletOptionNames.FilePrefix,"Prefix for coverage report filenames to prevent overwrites when multiple test projects write to the same directory.",ArgumentArity.ExactlyOne,isHidden:false),
newCommandLineOption(CoverletOptionNames.IncludeDirectory,"Include additional directories for instrumentation.",ArgumentArity.OneOrMore,isHidden:false),
0 commit comments