enhance multiple exclustion rules options and add test
This commit is contained in:
+7
-3
@@ -24,11 +24,15 @@
|
||||
</Target>
|
||||
|
||||
<Target Name="RunTests" AfterTargets="CopyMSBuildScripts">
|
||||
<Exec Command="dotnet test $(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover" />
|
||||
<Exec Command="dotnet test $(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="RunTestsWithExclude" AfterTargets="RunTests">
|
||||
<Exec Command="dotnet test --no-build $(MSBuildThisFileDirectory)test\coverlet.core.tests\coverlet.core.tests.csproj -c $(Configuration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude=\"../../src/coverlet.core/Instrumentation/**/*.cs,../../src/coverlet.core/Reporters/**/*.cs\""/>
|
||||
</Target>
|
||||
|
||||
<Target Name="CreateNuGetPackage" AfterTargets="RunTests" Condition="$(Configuration) == 'Release'">
|
||||
<Target Name="CreateNuGetPackage" AfterTargets="RunTestsWithExclude" Condition="$(Configuration) == 'Release'">
|
||||
<Exec Command="dotnet pack $(MSBuildThisFileDirectory)src\coverlet.msbuild.tasks\coverlet.msbuild.tasks.csproj -c $(Configuration) -o $(OutputPath) /p:NuspecFile=$(NuspecFile)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace Coverlet.MSbuild.Tasks
|
||||
[Required]
|
||||
public string Path { get; set; }
|
||||
|
||||
[Required]
|
||||
public string[] Exclude { get; set; }
|
||||
public string Exclude { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
Coverage = new Coverage(Path, Guid.NewGuid().ToString(), Exclude);
|
||||
var excludeRules = Exclude?.Split(',');
|
||||
Coverage = new Coverage(Path, Guid.NewGuid().ToString(), excludeRules);
|
||||
Coverage.PrepareModules();
|
||||
}
|
||||
catch(Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user