File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ pub struct CoverageArgs {
75
75
#[ arg( long) ]
76
76
include_libs : bool ,
77
77
78
+ /// Whether to exclude tests from the coverage report.
79
+ #[ arg( long) ]
80
+ exclude_tests : bool ,
81
+
78
82
/// The coverage reporters to use. Constructed from the other fields.
79
83
#[ arg( skip) ]
80
84
reporters : Vec < Box < dyn CoverageReporter > > ,
@@ -194,8 +198,10 @@ impl CoverageArgs {
194
198
for ( path, source_file, version) in output. output ( ) . sources . sources_with_version ( ) {
195
199
report. add_source ( version. clone ( ) , source_file. id as usize , path. clone ( ) ) ;
196
200
197
- // Filter out dependencies.
198
- if !self . include_libs && project_paths. has_library_ancestor ( path) {
201
+ // Filter out libs dependencies and tests.
202
+ if ( !self . include_libs && project_paths. has_library_ancestor ( path) ) ||
203
+ ( self . exclude_tests && project_paths. is_test ( path) )
204
+ {
199
205
continue ;
200
206
}
201
207
You can’t perform that action at this time.
0 commit comments