xunit.analyzers
xunit.analyzers copied to clipboard
Add ability to view code coverage
This PR adds the ability for users to generate and view code coverage reports for xunit.analyzers
, using OpenCover and ReportGenerator. It's as easy as navigating to the repo root in a command prompt and typing view-coverage
. The script will call dotnet test
with OpenCover generating results.xml
, then generate a report in <repo root>/reports/xunit.analyzers.tests/
and open it in the browser.
For an infrastructure PR, this contains a lot of code changes. Let me explain why:
- OpenCover mysteriously says everything is 0% coverage when
xunit.analyzers.tests
targetsnet452
. So I had to change it to targetnetcoreapp1.1
in order for the coverage to work.- This necessitated upgrading the version of
Microsoft.CodeAnalysis.CSharp
xunit.analyzers.tests
used, so I upgraded it to the latest version both there and inxunit.analyzers
.- This required changing
xunit.analyzers
to targetnetstandard1.3
, in turn requiringxunit.analyzers.vsix
to targetnet46
.
- This required changing
- Upgrading to netcoreapp1.1 also made some things not compile (e.g. needed extra
GetTypeInfo()
calls). It also screwed with the references inCodeAnalyzerHelper
, causing all the tests to fail sincetypeof(object).Assembly.Location
is no longer mscorlib.dll but System.Private.CoreLib.ni.dll. I had to rewrite most of the logic there.
- This necessitated upgrading the version of
@bradwilson I've changed the test project to target netcoreapp1.1 instead of net452. This has caused CI failures because currently we use the console runner from tools/net452
. I see there is an xunit.console.dll
in tools/netcoreapp1.0
, which I think is the solution to my problem, but there is no EXE file. Do you know how I can use it?
@marcind You haven't said anything on this one. Would you be willing to merge this if I can resolve conflicts/get CI passing?
Sorry, just have not had the time to look at everything. I'd like to try out what impact (if any) this change has on the development workflow. There's also a few things that concern me:
- targeting a some other target than 452. Probably not a big deal but I haven't thought through that yet
- upgrading some of the Roslyn dependencies. Not sure what impact that would have on The analyzers being able to run in VS 2015.
- there's a lot of change so just need to find the time to scrutinize them
@jamesqo That DLL is there for advanced users (you must know how to correctly use the undocumented dotnet exec
). Instead, .NET Core users who want functionality like xunit.console
should be using dotnet xunit
as illustrated here: https://xunit.github.io/docs/getting-started-dotnet-core.html
Apologies that this sat here for so long. I've picked up the project from Marcin, and just enabled better PR & CI builds via GitHub actions.
With the new .NET Core-based build system, is this PR still relevant? What is required to enable it in the new build system?
Closing for age.