File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,9 +54,17 @@ exports.instrument = function(options) {
5454 var matcher , instrumenter ;
5555
5656 matcher = function ( file ) {
57- if ( typeof options . coverage === 'string' ) return file . indexOf ( options . coverage ) === 0 ;
58- else if ( options . coverage instanceof RegExp ) return options . coverage . test ( file ) ;
59- else return file === options . code . path ;
57+ var files = options . coverage . files ;
58+ if ( files ) {
59+ files = Array . isArray ( files ) ? files : [ files ] ;
60+ return files . some ( function ( f ) {
61+ if ( typeof f === 'string' ) return file . indexOf ( f ) === 0 ;
62+ else if ( f instanceof RegExp ) return f . test ( file ) ;
63+ else throw new Error ( "invalid entry in options.coverage.files: " + typeof f ) ;
64+ } ) ;
65+ } else {
66+ return file === options . code . path ;
67+ }
6068 }
6169 instrumenter = new istanbul . Instrumenter ( ) ;
6270 istanbul . hook . hookRequire ( matcher , instrumenter . instrumentSync . bind ( instrumenter ) ) ;
You can’t perform that action at this time.
0 commit comments