Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating Html only for Native Coverage #87

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions src/CoveragePublisher/CoverageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,17 @@ public async Task ParseAndPublishCoverage(PublisherConfiguration config, Cancell

else
{
foreach (string nativeCoverageFile in config.CoverageFiles)
if(IsContainsNativeCoverage(config))
{
if (!(nativeCoverageFile.EndsWith(Constants.CoverageConstants.CoverageBufferFileExtension) || // .coveragebuffer
nativeCoverageFile.EndsWith(Constants.CoverageConstants.CoverageFileExtension) || // .coverage
nativeCoverageFile.EndsWith(Constants.CoverageConstants.CoverageBFileExtension) || //.covb
nativeCoverageFile.EndsWith(Constants.CoverageConstants.CoverageJsonFileExtension) || //.cjson
nativeCoverageFile.EndsWith(Constants.CoverageConstants.CoverageXFileExtension))) // .covx
using (new SimpleTimer("CoverageProcesser", "PublishHTMLReport", _telemetry))
{
using (new SimpleTimer("CoverageProcesser", "PublishHTMLReport", _telemetry))
{
await _publisher.PublishHTMLReport(config.ReportDirectory, token);
}
await _publisher.PublishHTMLReport(config.ReportDirectory, token);
}

}
else{
TraceLogger.Debug("Native coverage files are not present. Skipping HTML report generation.");
}
}

}
}
// Only catastrophic failures should trickle down to these catch blocks
Expand All @@ -125,5 +119,21 @@ public async Task ParseAndPublishCoverage(PublisherConfiguration config, Cancell
}
}
}

private bool IsContainsNativeCoverage(PublisherConfiguration config)
{
foreach (var coverageFile in config.CoverageFiles)
{
if (!(coverageFile.EndsWith(Constants.CoverageConstants.CoverageBufferFileExtension) || // .coveragebuffer
coverageFile.EndsWith(Constants.CoverageConstants.CoverageFileExtension) || // .coverage
coverageFile.EndsWith(Constants.CoverageConstants.CoverageBFileExtension) || //.covb
coverageFile.EndsWith(Constants.CoverageConstants.CoverageJsonFileExtension) || //.cjson
coverageFile.EndsWith(Constants.CoverageConstants.CoverageXFileExtension))) //.covx
{
return true;
}
}
return false;
}
}
}
Loading