File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/jest-haste-map/src Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ type Options = {
43
43
extensions : Array < string > ,
44
44
forceNodeFilesystemAPI ? : boolean ,
45
45
hasteImplModulePath ?: string ,
46
- ignorePattern : RegExp ,
46
+ ignorePattern : RegExp | Function ,
47
47
maxWorkers : number ,
48
48
mocksPattern ?: string ,
49
49
name : string ,
@@ -62,7 +62,7 @@ type InternalOptions = {
62
62
extensions : Array < string > ,
63
63
forceNodeFilesystemAPI : boolean ,
64
64
hasteImplModulePath ?: string ,
65
- ignorePattern : RegExp ,
65
+ ignorePattern : RegExp | Function ,
66
66
maxWorkers : number ,
67
67
mocksPattern : ?RegExp ,
68
68
name : string ,
@@ -685,8 +685,14 @@ class HasteMap extends EventEmitter {
685
685
* Helpers
686
686
*/
687
687
_ignore ( filePath : Path ) : boolean {
688
+ const ignorePattern = this . _options . ignorePattern ;
689
+ const ignoreMatched =
690
+ Object . prototype . toString . call ( ignorePattern ) === '[object RegExp]'
691
+ ? ignorePattern . test ( filePath ) // $FlowFixMe
692
+ : ignorePattern ( filePath ) ;
693
+
688
694
return (
689
- this . _options . ignorePattern . test ( filePath ) ||
695
+ ignoreMatched ||
690
696
( ! this . _options . retainAllFiles && this . _isNodeModulesDir ( filePath ) )
691
697
) ;
692
698
}
You can’t perform that action at this time.
0 commit comments