Skip to content

Commit d576710

Browse files
committed
feat(coverage): add global coverage settings for tests
1 parent 7fba9a5 commit d576710

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Directory.Build.props

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Product>MyCSharp.HttpUserAgentParser</Product>
44
<Authors>MyCSharp, BenjaminAbt, gfoidl</Authors>
55
<Company>myCSharp.de</Company>
6+
<Copyright>myCSharp.de</Copyright>
67
</PropertyGroup>
78

89
<PropertyGroup Label="Vars">
@@ -27,7 +28,11 @@
2728
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)MyCSharp.HttpUserAgentParser.snk</AssemblyOriginatorKeyFile>
2829

2930
<PublicKey>
30-
00240000048000009400000006020000002400005253413100040000010001003d5c022c088a46d41d5a5bf7591f3a3dcba30f76b0f43a312b6e45bb419d32283175cbd8bfd83134b123da6db83479e50596fb6bbe0e8c6cef50c01c64a0861c963daaf6905920f44ffe1ce44b3cfcb9c23779f34bc90c7b04e74e36a19bb58af3a69456d49b56993969dba9f8e9e935c2757844a11066d1091477f10cd923b7
31+
00240000048000009400000006020000002400005253413100040000010001003d5c022c088a46
32+
d41d5a5bf7591f3a3dcba30f76b0f43a312b6e45bb419d32283175cbd8bfd83134b123da6db834
33+
79e50596fb6bbe0e8c6cef50c01c64a0861c963daaf6905920f44ffe1ce44b3cfcb9c23779f34b
34+
c90c7b04e74e36a19bb58af3a69456d49b56993969dba9f8e9e935c2757844a11066d1091477f1
35+
0cd923b7
3136
</PublicKey>
3237
</PropertyGroup>
3338

@@ -73,6 +78,21 @@
7378
<NuGetAuditLevel>low</NuGetAuditLevel>
7479
</PropertyGroup>
7580

81+
<!-- Global coverage settings applied to all test projects -->
82+
<PropertyGroup Condition="'$(IsTestProject)' == 'true'" Label="Coverage">
83+
<CollectCoverage>true</CollectCoverage>
84+
<CoverletOutputFormat>lcov,opencover,cobertura</CoverletOutputFormat>
85+
<CoverletOutput>$(MSBuildThisFileDirectory)TestResults/coverage/$(MSBuildProjectName).</CoverletOutput>
86+
<ExcludeByAttribute>GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
87+
<ExcludeByFile>**/*Program.cs;**/*Startup.cs;**/*GlobalUsings.cs</ExcludeByFile>
88+
<UseSourceLink>true</UseSourceLink>
89+
<!-- Enforce high line coverage; branch coverage is informative only -->
90+
<!-- Note: Set to 96 to account for performance-optimized helper methods and framework-specific code paths -->
91+
<Threshold>96</Threshold>
92+
<ThresholdType>line</ThresholdType>
93+
<ThresholdStat>total</ThresholdStat>
94+
</PropertyGroup>
95+
7696
<ItemGroup Label="Default Test Dependencies" Condition="'$(IsTestProject)' == 'true'">
7797
<PackageReference Include="coverlet.msbuild" />
7898
<PackageReference Include="Microsoft.NET.Test.Sdk" />

0 commit comments

Comments
 (0)