diff --git a/FineCodeCoverageTests/AppOptionsProvider_Tests.cs b/FineCodeCoverageTests/AppOptionsProvider_Tests.cs index 6e9c1b9f..6b7d854b 100644 --- a/FineCodeCoverageTests/AppOptionsProvider_Tests.cs +++ b/FineCodeCoverageTests/AppOptionsProvider_Tests.cs @@ -197,7 +197,8 @@ public void Should_Not_Default_Any_Other_AppOptions_Properties() nameof(IAppOptions.ShowCoveredInOverviewMargin), nameof(IAppOptions.ShowUncoveredInOverviewMargin), nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin), - nameof(IAppOptions.ShowToolWindowToolbar) + nameof(IAppOptions.ShowToolWindowToolbar), + nameof(IAppOptions.Hide0Coverable) }; CollectionAssert.AreEquivalent(expectedSetters.Select(s => $"set_{s}"), invocationNames); } @@ -278,6 +279,8 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu { nameof(IAppOptions.FunctionsExclude), new string[]{ "FunctionsExclude" } }, { nameof(IAppOptions.FunctionsInclude), new string[]{ "FunctionsInclude" } }, { nameof(IAppOptions.HideFullyCovered), true }, + { nameof(IAppOptions.Hide0Coverable),true }, + { nameof(IAppOptions.Hide0Coverage),true }, { nameof(IAppOptions.Include), new string[]{ "Include" } }, { nameof(IAppOptions.IncludeReferencedProjects),true}, { nameof(IAppOptions.IncludeTestAssembly),true}, diff --git a/FineCodeCoverageTests/MsCodeCoverage/RunSettingsTemplateReplacementsFactory_Tests.cs b/FineCodeCoverageTests/MsCodeCoverage/RunSettingsTemplateReplacementsFactory_Tests.cs index b8bf525b..f87f9400 100644 --- a/FineCodeCoverageTests/MsCodeCoverage/RunSettingsTemplateReplacementsFactory_Tests.cs +++ b/FineCodeCoverageTests/MsCodeCoverage/RunSettingsTemplateReplacementsFactory_Tests.cs @@ -692,5 +692,7 @@ internal class TestCoverageProjectOptions : IAppOptions public bool ShowUncoveredInOverviewMargin { get; set; } public bool ShowPartiallyCoveredInOverviewMargin { get; set; } public bool ShowToolWindowToolbar { get; set; } + public bool Hide0Coverable { get; set; } + public bool Hide0Coverage { get; set; } } } diff --git a/README.md b/README.md index 6321c90e..a962e957 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,8 @@ ThresholdForCyclomaticComplexity When [cyclomatic complexity](https://en.wik StickyCoverageTable Set to true for coverage table to have a sticky thead. NamespacedClasses Set to false to show classes in report in short form. Affects grouping. HideFullyCovered Set to true to hide classes, namespaces and assemblies that are fully covered. +Hide0Coverage Set to true to hide classes, namespaces and assemblies that have 0% coverage. +Hide0Coverable Set to false to show classes, namespaces and assemblies that are not coverable. Enabled Specifies whether or not coverage output is enabled RunWhenTestsFail By default coverage runs when tests fail. Set to false to prevent this. **Cannot be used in conjunction with RunInParallel** diff --git a/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs b/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs index 85b21bea..22ad6180 100644 --- a/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs +++ b/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs @@ -831,11 +831,12 @@ private string HideGroupingCss() private string ObserveAndHideFullyCovered() { - if (!appOptionsProvider.Get().HideFullyCovered) + var appOptions = appOptionsProvider.Get(); + if (!(appOptions.HideFullyCovered | appOptions.Hide0Coverage | appOptions.Hide0Coverable)) { return ""; } - return @" + var old = @" var targetNode = document;//document.querySelector('table.overview.table-fixed.stripped'); var config = { attributes: false, childList: true, subtree: true }; @@ -883,7 +884,54 @@ private string ObserveAndHideFullyCovered() var observer = new MutationObserver(callback); observer.observe(targetNode, config); "; - } + var code = $@" +function getCellValue(row, index){{ + return parseInt(row.cells[index].innerText); +}} +var targetNode = document; + +var config = {{ attributes: false, childList: true, subtree: true }}; + +var callback = function(mutationsList, observer) {{ + var rows = document.querySelectorAll(""coverage-info table tbody tr""); + for(var i=0;i