coverlet
coverlet copied to clipboard
Exclude by Base class \ Interface?
We have many projects with EF migrations and no one is using the Down
Method to revert a migration, so we don't care of covering it with UTs.
Ideally it would be best to exclude only the Down
method, but assuming that is impossible without decorating each method with [ExcludeFromCodeCoverage]
, we would like to ignore all classes deriving from the BaseClass Microsoft.EntityFrameworkCore.Migrations.Migration
.
Is it possible with coverlet?
It's not possible now, but for migrations specifically you can try to use Exclude
to exclude them by the namespace they end up in, or ExcludeByFile
by the directory: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#excluding-from-coverage
Yes, this what we ended up doing:
<ExcludeByFile>**/*.DataAccess/*Migrations/*.cs,...
I was wondering if there is a better and more explicit way for that (and hopefully only ignore specific a method though assumed this one is impossible).
This issue is stale because it has been open for 3 months with no activity.
Yes, this what we ended up doing:
<ExcludeByFile>**/*.DataAccess/*Migrations/*.cs,...
I was wondering if there is a better and more explicit way for that (and hopefully only ignore specific a method though assumed this one is impossible).
Solution available. Issue closed.