Romanx / Cake.Coverlet

Coverlet extensions for Cake Build
MIT License
40 stars 15 forks source link

Multiple CoverletOutputFormat #12

Closed VladislavAntonyuk closed 5 years ago

VladislavAntonyuk commented 5 years ago

Add support to setup List<CoverletOutputFormat>

CoverletOutputFormats = new List<CoverletOutputFormat> {
CoverletOutputFormat.opencover,
CoverletOutputFormat.covertura
};
Romanx commented 5 years ago

Hi there,

You can support multiple coverlet formats by providing them like this:

var coveletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover | CoverletOutputFormat.covertura,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    };

Or by using the method on the settings class like this:

var coveletSettings = new CoverletSettings {
        CollectCoverage = true,
        CoverletOutputFormat = CoverletOutputFormat.opencover,
        CoverletOutputDirectory = Directory(@".\coverage-results\"),
        CoverletOutputName = $"results-{DateTime.UtcNow:dd-MM-yyyy-HH-mm-ss-FFF}"
    }.WithFormat(CoverletOutputFormat.covertura);

I'll use this issue as a note to improve the documentation in the readme. Thanks

VladislavAntonyuk commented 5 years ago

Great!, thnak you, I will close the issue after you add documentation

Roemer commented 4 years ago

This does not work for us. How about providing a placeholder (like %format%) in the CoverletOutputName that is automatically replaced with the defined format. So we could use:

CoverletOutputName = $"{projectName}-%format%.xml"

to generate xxx-opencover.xml and xxx-cobertura.xml and we would not need to rely on timestamps anymore.