Skip to content

Commit

Permalink
Merge pull request #634 from sys27/revert-631-feature/coverlet
Browse files Browse the repository at this point in the history
Revert "#630 - Use Coverlet VSTest integration."
  • Loading branch information
sys27 authored May 10, 2023
2 parents b5ff31a + e892635 commit 790899c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 65 deletions.
15 changes: 6 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
"args": [
"test",
"${workspaceFolder}/xFunc.sln",
"-c:${input:configurationType}",
"--collect:\"XPlat Code Coverage\"",
"--settings",
"runsettings.xml"
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
Expand All @@ -53,13 +51,12 @@
"command": "dotnet",
"type": "process",
"args": [
"msbuild",
"test",
"${workspaceFolder}/xFunc.sln",
"-p:Configuration=${input:configurationType}",
"-target:\"xFunc_Tests:GenerateHtmlCoverageReport\""
"-c:${input:configurationType}",
"-p:CollectCoverage=true"
],
"problemMatcher": "$msCompile",
"dependsOn": ["Test"]
"problemMatcher": "$msCompile"
}
],
"inputs": [
Expand Down
10 changes: 1 addition & 9 deletions CI/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,9 @@ jobs:
inputs:
command: test
projects: '$(solution)'
arguments: '--nologo --no-build -c $(buildConfiguration) --collect:"XPlat Code Coverage" --settings runsettings.xml'
arguments: '--nologo --no-build -c $(buildConfiguration) -p:CollectCoverage=true -p:CoverletOutput=$(Build.SourcesDirectory)/coverage/'
publishTestResults: true

- task: DotNetCoreCLI@2
displayName: 'Generate Report'
inputs:
command: custom
custom: msbuild
projects: '$(solution)'
arguments: '-p:Configuration=$(buildConfiguration) -p:_PathToCopy="$(Agent.TempDirectory)/**/coverage.cobertura.xml" -target:"xFunc_Tests:GenerateHtmlCoverageReport"'

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.2" />

<PackageVersion Include="coverlet.collector" Version="3.2.0" />
<PackageVersion Include="coverlet.msbuild" Version="3.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageVersion Include="Moq" Version="4.18.3" />
<PackageVersion Include="ReportGenerator" Version="5.1.12" />
Expand Down
28 changes: 0 additions & 28 deletions runsettings.xml

This file was deleted.

26 changes: 9 additions & 17 deletions xFunc.Tests/xFunc.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
<RootNamespace>xFunc.Tests</RootNamespace>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
<CoverletOutput>../coverage/</CoverletOutput>
<ExcludeByAttribute>ExcludeFromCodeCoverage,GeneratedCode</ExcludeByAttribute>
<Exclude>[xFunc.*]*Exception</Exclude>
<Threshold>90</Threshold>
<ThresholdStat>total</ThresholdStat>
<ImplicitUsings>enable</ImplicitUsings>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<_CoverageFolder>$(SolutionDir)/coverage</_CoverageFolder>
<_CoverageFileName>coverage.cobertura.xml</_CoverageFileName>
<_PathToCopy>$(_CoverageFolder)/**/$(_CoverageFileName)</_PathToCopy>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -44,23 +47,12 @@
<Using Include="Xunit" />
</ItemGroup>

<Target Name="RemoveCoverageFolder" BeforeTargets="VSTest">
<RemoveDir Directories="$(_CoverageFolder)" />
</Target>

<Target Name="GenerateHtmlCoverageReport">
<CreateItem Include="$(_PathToCopy)">
<Output TaskParameter="Include" ItemName="CoverageReport" />
</CreateItem>
<Copy SourceFiles="@(CoverageReport)"
DestinationFolder="$(_CoverageFolder)" />
<ReportGenerator ReportFiles="$(_CoverageFolder)/$(_CoverageFileName)"
TargetDirectory="$(_CoverageFolder)"
ReportTypes="HtmlInline_AzurePipelines" />
<Target Name="GenerateHtmlCoverageReport" AfterTargets="GenerateCoverageResultAfterTest" Condition="'$(CollectCoverage)' == 'true'">
<ReportGenerator ReportFiles="$(CoverletOutput)/coverage.cobertura.xml" TargetDirectory="$(CoverletOutput)" ReportTypes="HtmlInline_AzurePipelines" />
</Target>

<ItemGroup>
<PackageReference Include="coverlet.collector" PrivateAssets="All" />
<PackageReference Include="coverlet.msbuild" PrivateAssets="All" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="ReportGenerator" />
Expand Down
1 change: 0 additions & 1 deletion xFunc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.stylecop.json = .stylecop.json
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
runsettings.xml = runsettings.xml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{7D6A31E3-42CF-49E7-A0D2-657A460388BC}"
Expand Down

0 comments on commit 790899c

Please sign in to comment.