enhance multiple exclustion rules options and add test

This commit is contained in:
Ido David
2018-04-29 02:08:19 -04:00
parent 4ddf02df7d
commit cd538e3dd1
2 changed files with 10 additions and 6 deletions
+7 -3
View File
@@ -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=\&quot;../../src/coverlet.core/Instrumentation/**/*.cs,../../src/coverlet.core/Reporters/**/*.cs\&quot;"/>
</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)