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 = {
4343 extensions : Array < string > ,
4444 forceNodeFilesystemAPI ? : boolean ,
4545 hasteImplModulePath ?: string ,
46- ignorePattern : RegExp ,
46+ ignorePattern : RegExp | Function ,
4747 maxWorkers : number ,
4848 mocksPattern ?: string ,
4949 name : string ,
@@ -62,7 +62,7 @@ type InternalOptions = {
6262 extensions : Array < string > ,
6363 forceNodeFilesystemAPI : boolean ,
6464 hasteImplModulePath ?: string ,
65- ignorePattern : RegExp ,
65+ ignorePattern : RegExp | Function ,
6666 maxWorkers : number ,
6767 mocksPattern : ?RegExp ,
6868 name : string ,
@@ -688,7 +688,13 @@ class HasteMap extends EventEmitter {
688688 * Helpers
689689 */
690690 _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 ||
692698 ( ! this . _options . retainAllFiles && this . _isNodeModulesDir ( filePath ) ) ;
693699 }
694700
You can’t perform that action at this time.
0 commit comments