Skip to content

Commit 7f565ef

Browse files
authored
Add ReportGenerator to baseline exclude filters (#1958)
Update CoverageConfiguration to always exclude "[ReportGenerator.*]*" assemblies. Adjust related tests in CoverageConfigurationDynamicExcludeTests to reflect the new baseline filter and remove dynamic exclusion expectations for ReportGenerator.
1 parent 6dbe06d commit 7f565ef

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/coverlet.MTP/Configuration/CoverageConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal sealed class CoverageConfiguration
1818

1919
// Permanent baseline: coverlet assemblies must always be excluded regardless of source.
2020
// All other test-framework assemblies are discovered dynamically at runtime via IProcessAssemblyHelper.
21-
private static readonly string[] s_baselineExcludeFilters = ["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*"];
21+
private static readonly string[] s_baselineExcludeFilters = ["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*", "[ReportGenerator.*]*"];
2222

2323
private static readonly string[] s_defaultExcludeByAttributes =
2424
[

test/coverlet.MTP.tests/Configuration/CoverageConfigurationDynamicExcludeTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void WhenNoConfigFileThenDepsJsonFiltersApplied()
4747
{
4848
_mockProcessAssemblyHelper
4949
.Setup(x => x.GetDepsJsonAssemblyNames(s_fakeModuleDir, TestAssemblyName))
50-
.Returns(["xunit.core", "ReportGenerator.Mtp"]);
50+
.Returns(["xunit.core"]);
5151
_mockProcessAssemblyHelper
5252
.Setup(x => x.GetLoadedAssemblyNames(TestAssemblyName))
5353
.Returns([]);
@@ -62,7 +62,6 @@ public void WhenNoConfigFileThenDepsJsonFiltersApplied()
6262
string[] result = config.GetExcludeFilters();
6363

6464
Assert.Contains("[xunit.core]*", result);
65-
Assert.Contains("[ReportGenerator.Mtp]*", result);
6665
}
6766

6867
[Fact]
@@ -106,7 +105,7 @@ public void WhenDepsJsonHelperReturnsEmptyListThenBaselineFallbackUsed()
106105

107106
string[] result = config.GetExcludeFilters();
108107

109-
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*"], result);
108+
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*", "[ReportGenerator.*]*"], result);
110109
}
111110

112111
[Fact]
@@ -127,7 +126,7 @@ public void WhenDepsJsonHelperThrowsThenBaselineFallbackUsed()
127126

128127
string[] result = config.GetExcludeFilters();
129128

130-
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*"], result);
129+
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*", "[ReportGenerator.*]*"], result);
131130
}
132131

133132
[Fact]
@@ -166,7 +165,7 @@ public void WhenNullTestModulePathThenBaselineOnlyReturned()
166165

167166
string[] result = config.GetExcludeFilters();
168167

169-
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*"], result);
168+
Assert.Equal(["[coverlet.*]*", "[Microsoft.VisualStudio.TestPlatform.*]*", "[testhost*]*", "[ReportGenerator.*]*"], result);
170169
_mockProcessAssemblyHelper.Verify(
171170
x => x.GetDepsJsonAssemblyNames(It.IsAny<string>(), It.IsAny<string>()),
172171
Times.Never);

0 commit comments

Comments
 (0)