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 ,
@@ -688,7 +688,13 @@ class HasteMap extends EventEmitter {
688
688
* Helpers
689
689
*/
690
690
_ignore ( filePath : Path ) : boolean {
691
- return this . _options . ignorePattern . test ( filePath ) ||
691
+ const ignorePattern = this . _options . ignorePattern ;
692
+ const ignoreMatched =
693
+ Object . prototype . toString . call ( ignorePattern ) === '[object RegExp]'
694
+ ? ignorePattern . test ( filePath ) // $FlowFixMe
695
+ : ignorePattern ( filePath ) ;
696
+
697
+ return ignoreMatched ||
692
698
( ! this . _options . retainAllFiles && this . _isNodeModulesDir ( filePath ) ) ;
693
699
}
694
700
You can’t perform that action at this time.
0 commit comments