coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

Is it possible to write exclusion expressions in a file and feed it to coverlet coverage counting?

Open everwisher opened this issue 2 years ago • 3 comments

I just need to cherry-pick a bunch of classes and methods that are inappropriate for unit testing out of a big solution consisting of a number of projects. As these units are distributed to a lot of files, it would be ugly to attach a super long arguments to set them all out of the testing. So is there a way to create a file of certain format that allows input of the expressions via argument all at once?

everwisher avatar Aug 18 '22 04:08 everwisher

We don't have that feature at the moment, isn't enough glob patterns like https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#source-files? I don't know if rsp file can be useful in this case https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-response-files?view=vs-2022

MarcoRossignoli avatar Aug 25 '22 08:08 MarcoRossignoli

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar Sep 04 '23 00:09 github-actions[bot]

You can use a props file which should be imported for test projects.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <PropertyGroup>
   <CollectCoverage Condition="$(CollectCoverage) == ''">false</CollectCoverage>
   <Include Condition="$(Include) == ''"></Include>
   <IncludeDirectory Condition="$(IncludeDirectory) == ''"></IncludeDirectory>
   <Exclude Condition="$(Exclude) == ''"></Exclude>
   <ExcludeByFile Condition="$(ExcludeByFile) == ''"></ExcludeByFile>
   <ExcludeByAttribute Condition="$(ExcludeByAttribute) == ''"></ExcludeByAttribute>
   <IncludeTestAssembly Condition="'$(IncludeTestAssembly)' == ''">false</IncludeTestAssembly>
   <SingleHit Condition="'$(SingleHit)' == ''">false</SingleHit>
   <MergeWith Condition="$(MergeWith) == ''"></MergeWith>
   <UseSourceLink Condition="$(UseSourceLink) == ''">false</UseSourceLink>
   <DeterministicReport Condition="$(DeterministicReport) == ''">false</DeterministicReport>
   <CoverletOutputFormat Condition="$(CoverletOutputFormat) == ''">json</CoverletOutputFormat>
   <CoverletOutput Condition="$(CoverletOutput) == ''">$([MSBuild]::EnsureTrailingSlash('$(MSBuildProjectDirectory)'))</CoverletOutput>
   <Threshold Condition="$(Threshold) == ''">0</Threshold>
   <ThresholdType Condition="$(ThresholdType) == ''">line,branch,method</ThresholdType>
   <ThresholdStat Condition="$(ThresholdStat) == ''">minimum</ThresholdStat>
   <ExcludeAssembliesWithoutSources Condition="$(ExcludeAssembliesWithoutSources) == ''"></ExcludeAssembliesWithoutSources>
 </PropertyGroup>
</Project>

Bertk avatar Feb 12 '24 14:02 Bertk

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]