corvus-dotnet / Corvus.Extensions.Newtonsoft.Json

Opinionated configuration for Newtonsoft.Json including Microsoft DI support. Sponsored by endjin.
Apache License 2.0
2 stars 0 forks source link

Code coverage not working #66

Open idg10 opened 4 years ago

idg10 commented 4 years ago

Our builds are reporting 0% code coverage. In fact we're at over 85%. Work out why this isn't showing up in the build results.

idg10 commented 4 years ago

Seems to be something to do with https://github.com/tonerdo/coverlet/issues/766 so until we get to the bottom of that we're stuck with this. We can run code coverage in VS, we just don't get it in the CI build.

idg10 commented 4 years ago

Tried suggestion at https://github.com/tonerdo/coverlet/issues/766#issuecomment-601201937 but just got:

Data collection : Unable to find a datacollector with friendly name 'XPlat Code Coverage'.
Data collection : Could not find data collector 'XPlat Code Coverage'

I suspect this is because we need to add a <RunSettings>, so this isn't a quick fix—we'd need to change every test project we have and also our CI/DI templates. If there's some reason this is a better approach then that might be worth doing, but it's not currently clear to me why an approach based around VS Test features is inherently more cross-platform-friendly than one based around MSBuild.

So it might actually be better to offer a PR to fix https://github.com/dotnet/sdk/issues/10914 because that definitely looks like it shouldn't be doing that, and if we can stop it, that will remove the problems that's causing Coverlet to trip over.

mwadams commented 4 years ago

I agree that a PR to fix the issue is the better solution.

idg10 commented 4 years ago

Looking at this again, I was unable to reproduce the problem with the current SDK. I've yet to work out what change has had this effect. In any case, progress on this is blocked until SpecFlow 3.3 is released, because their fix for the breakage that occurred when .NET SDK 3.1.200 came out is going into 3.3. So until we can upgrade to SpecFlow 3.3 we can't upgrade to the latest .NET SDK. once we can do that, we can then test this again and see if the problem still occurs.