You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,18 +87,34 @@ You can ignore a method or an entire class from code coverage by creating and ap
87
87
Coverlet just uses the type name, so the attributes can be created under any namespace of your choosing.
88
88
89
89
#### Source Files
90
-
You can also ignore specific source files from code coverage using the `Exclude` property
90
+
You can also ignore specific source files from code coverage using the `ExcludeByFile` property
91
91
- Use single or multiple paths (separate by comma)
92
92
- Use absolute or relative paths (relative to the project directory)
93
93
- Use file path or directory path with globbing (e.g `dir1/*.cs`)
94
94
95
95
```bash
96
-
dotnet test /p:CollectCoverage=true /p:Exclude=\"../dir1/class1.cs,../dir2/*.cs,../dir3/**/*.cs,\"
96
+
dotnet test /p:CollectCoverage=true /p:ExcludeByFile=\"../dir1/class1.cs,../dir2/*.cs,../dir3/**/*.cs,\"
97
97
```
98
98
99
+
#### Filters
100
+
Coverlet gives the ability to have fine grained control over what gets excluded using "filter expressions".
101
+
102
+
Syntax: `/p:Exclude=[Assembly-Filter]Type-Filter`
103
+
104
+
Examples
105
+
-`/p:Exclude="[*]*"` => Excludes all types in all assemblies (nothing is instrumented)
106
+
-`/p:Exclude="[coverlet.*]Coverlet.Core.Coverage"` => Excludes the Coverage class in the `Coverlet.Core` namespace belonging to any assembly that matches `coverlet.*` (e.g `coverlet.core`)
107
+
-`/p:Exclude="[*]Coverlet.Core.Instrumentation.*"` => Excludes all types belonging to `Coverlet.Core.Instrumentation` namespace in any assembly
108
+
109
+
```bash
110
+
dotnet test /p:CollectCoverage=true /p:Exclude="[coverlet.*]Coverlet.Core.Coverage"
111
+
```
112
+
113
+
You can specify multiple fiter expressions by separting them with a comma (`,`).
114
+
99
115
## Roadmap
100
116
101
-
*Filter modules to be instrumented
117
+
*Merging outputs (multiple test projects, one coverage result)
102
118
* Support for more output formats (e.g. JaCoCo)
103
119
* Console runner (removes the need for requiring a NuGet package)
0 commit comments