coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

Predictable folder - single code coverage file

Open steveoh opened this issue 2 years ago • 6 comments

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 avatar Jun 21 '23 16:06 steveoh

👻

steveoh avatar Jul 10 '23 13:07 steveoh

Hi,

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

Alternative:

  • use msbuild target after test and copy coverage results to project unit folder
  • use msbuild target before test execution and delete folders in „TestResults“ folder

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

Bertk avatar Aug 28 '23 10:08 Bertk

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?

steveoh avatar Aug 28 '23 20:08 steveoh

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

Bertk avatar Aug 29 '23 06:08 Bertk

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

github-actions[bot] avatar Dec 10 '23 01:12 github-actions[bot]

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

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]