You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project where code-coverage with coverlet worked perfectly, but have now added an typed graphql client to this project, using the StrawberryShake client, which adds the package StrawberryShake.CodeGeneration.CSharp.Analyzers that injects a roslyn analyser which auto-generates code.
I have tried many variations of flags to coverlet, like:
dotnet test --no-build --no-restore src/TestUnit/ /p:CopyLocalLockFileAssemblies=true /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=cobertura
When I exclude the above package, I get output resembling this:
Test run for /src/TestUnit/bin/Debug/net5.0/TestUnit.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.1
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 254, Skipped: 0, Total: 254, Duration: 818 ms - /src/TestUnit/bin/Debug/net5.0/TestUnit.dll (net5.0)
Calculating coverage result...
Generating report 'TestResults/coverage.cobertura.xml'
+------------------------+--------+--------+--------+
| Module | Line | Branch | Method |
+------------------------+--------+--------+--------+
| ServiceA.ServiceClient | 27.56% | 21.6% | 22.77% |
+------------------------+--------+--------+--------+
| ServiceA.Abstractions | 0% | 100% | 0% |
+------------------------+--------+--------+--------+
| ServiceA.Service | 0.83% | 0% | 2.34% |
+------------------------+--------+--------+--------+
When I include the package again in my .csproj file the entire ServiceA.ServiceClient line disappears from the coverlet output.
Other technical details for debugging this:
macOS Catalina
dotnet 5.0.101
coverlet.msbuild 3.0.3
coverlet.collector 3.0.3
Microsoft.NET.Test.Sdk 16.9.1
The text was updated successfully, but these errors were encountered:
This is likely the same issue that generated source files should have the somewhat conventional .g.cs suffix for Coverlet to recognise them, which StrawberryShake probably doesn't follow resulting in this issue. See also #1164 for a more general solution to this.
I have a project where code-coverage with coverlet worked perfectly, but have now added an typed graphql client to this project, using the StrawberryShake client, which adds the package
StrawberryShake.CodeGeneration.CSharp.Analyzers
that injects a roslyn analyser which auto-generates code.I have tried many variations of flags to coverlet, like:
When I exclude the above package, I get output resembling this:
When I include the package again in my .csproj file the entire
ServiceA.ServiceClient
line disappears from the coverlet output.Other technical details for debugging this:
The text was updated successfully, but these errors were encountered: