coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.99k stars 386 forks source link

Predictable folder - single code coverage file #1494

Closed steveoh closed 1 month ago

steveoh commented 1 year ago

When using the coverage gutters vscode extension, coverage results do not update properly while running dotnet watch test. I assume this is the case since the tool does not know which random folder has the latest results to display. And if it tries to merge them, it may not understand the proper order?

I read the following but it would be great to be able to override this design setting to create a single file that is overwritten while I dotnet watch test --collect...

NB: By design VSTest platform will create your file under a random named folder(guid string) so if you need stable path to load file to some gui report system(i.e. coveralls, codecov, reportgenerator etc..) that doesn't support glob patterns or hierarchical search, you'll need to manually move resulting file to a predictable folder.

steveoh commented 1 year ago

👻

Bertk commented 1 year ago

Hi,

please try coverlet.msbuild which does not use vstest result folder.

Alternative:

https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets?view=vs-2022#sdk-and-default-build-targets

steveoh commented 1 year ago

Ok. I'll check out that package. I think that is what I'm using already though.

The build targets seem like a lift for a basic feature. A cli flag would be preferred no?

Bertk commented 1 year ago

Please note: This is not a coverlet issue but related to VS code tooling. I use dotnet CLI for build and test.

The dotnet example is using coverlet.msbuild but you use "dotnet watch test --collect..." which requires coverlet.collector.

The MSBuild target might not be necessary but allows to relocate build result easily. https://learn.microsoft.com/en-us/visualstudio/msbuild/copy-task?view=vs-2022

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 3 months with no activity.

Bertk commented 1 month ago

This is not a coverlet issue but related to VS code tooling.