-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to exclude .cshtml views from code coverage in coverlet #1537
Comments
facing the same issue with autogenerated code. |
Hi, I use the
You find also a example for the class filter in coverlet build pipeline : Run tests with coverage |
The coberatura.xml file for a Razor Page project will have sections like: <class name="RazorPagesTestSample.Pages.ErrorModel" filename="Pages\Error.cshtml" line-rate="0" branch-rate="0" complexity="6">
<methods>
...
</method>
</class> This command will remove the *cshtml files from cobertura.xml report:
|
This issue is stale because it has been open for 3 months with no activity. |
Hey everyone, Destaleling (should be a word) this one for clarity. The filtering expression @Bertk provided works. I also had a problem when excluding the views as well as other folders. I think there is no Issue with Coverlet here, but i might be wrong. The situation arises when you try to exclude specific views using folder structure filtering syntax instead of all .cshtml files. I think that the real issue is the folder structure of the Views folder, i.e. the filtering expressions people try out. So if you try out his code: It excludes only the .cshtml files at the root level of the Views folder like _ViewStart.cshtml. This is what works and what it does from what i have found: Exclude all .cshtml files
Exclude all .cshtml files from the MainApp.MVC/Views folder
Exclude all .cshtml fles from an Area Views folder
Tested Example:
`
Considerations for addition to documentation:
|
Coverlet does not support Microsoft coverage syntax Customize code coverage analysis |
This issue is stale because it has been open for 3 months with no activity. |
Solution available. See replies of this issue or similar closed issues with "cshtml" files e.g. #1375 |
Hi I am having same issue i am not able to exclude Views- .cshtml from coverge
My Folder structure in solution is .Web /Views- .cshtml files
in the coverge result it is showing as AspNetCoreGeneraterDocumnet is 0 % . Please help which command should be used to exclude .cshtml pages.
I tried filter and exclude
The text was updated successfully, but these errors were encountered: