File tree Expand file tree Collapse file tree 6 files changed +20
-18
lines changed Expand file tree Collapse file tree 6 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {Config} from '@jest/types';
1212import { ValidationError , validate } from 'jest-validate' ;
1313import { clearLine , replacePathSepForGlob } from 'jest-util' ;
1414import chalk from 'chalk' ;
15- import { some as micromatchSome } from 'micromatch' ;
15+ import micromatch from 'micromatch' ;
1616import { sync as realpath } from 'realpath-native' ;
1717import Resolver from 'jest-resolve' ;
1818import { replacePathSepForRegex } from 'jest-regex-util' ;
@@ -982,10 +982,10 @@ export default function normalize(
982982 if ( newOptions . collectCoverageFrom ) {
983983 collectCoverageFrom = collectCoverageFrom . reduce ( ( patterns , filename ) => {
984984 if (
985- ! micromatchSome (
986- replacePathSepForGlob ( path . relative ( options . rootDir , filename ) ) ,
985+ ! micromatch (
986+ [ replacePathSepForGlob ( path . relative ( options . rootDir , filename ) ) ] ,
987987 newOptions . collectCoverageFrom ! ,
988- )
988+ ) . length
989989 ) {
990990 return patterns ;
991991 }
Original file line number Diff line number Diff line change 66 */
77
88import * as path from 'path' ;
9- import { some as micromatchSome } from 'micromatch' ;
9+ import micromatch from 'micromatch' ;
1010import { Context } from 'jest-runtime' ;
1111import { Config } from '@jest/types' ;
1212import { Test } from 'jest-runner' ;
@@ -37,7 +37,7 @@ export type TestSelectionConfig = {
3737} ;
3838
3939const globsToMatcher = ( globs : Array < Config . Glob > ) => ( path : Config . Path ) =>
40- micromatchSome ( replacePathSepForGlob ( path ) , globs , { dot : true } ) ;
40+ ! ! micromatch ( [ replacePathSepForGlob ( path ) ] , globs , { dot : true } ) . length ;
4141
4242const regexToMatcher = ( testRegex : Array < string > ) => ( path : Config . Path ) =>
4343 testRegex . some ( testRegex => new RegExp ( testRegex ) . test ( path ) ) ;
Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8- import { some as micromatchSome } from 'micromatch' ;
8+ import micromatch from 'micromatch' ;
99import { replacePathSepForGlob } from 'jest-util' ;
1010import { Config } from '@jest/types' ;
1111import { FileData } from './types' ;
@@ -86,7 +86,7 @@ export default class HasteFS {
8686 const files = new Set < string > ( ) ;
8787 for ( const file of this . getAbsoluteFileIterator ( ) ) {
8888 const filePath = root ? fastPath . relative ( root , file ) : file ;
89- if ( micromatchSome ( replacePathSepForGlob ( filePath ) , globs ) ) {
89+ if ( micromatch ( [ replacePathSepForGlob ( filePath ) ] , globs ) . length ) {
9090 files . add ( file ) ;
9191 }
9292 }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import * as fs from 'fs';
1010import * as path from 'path' ;
1111import { EventEmitter } from 'events' ;
1212import anymatch , { Matcher } from 'anymatch' ;
13- import { some as micromatchSome } from 'micromatch' ;
13+ import micromatch from 'micromatch' ;
1414// eslint-disable-next-line
1515import { Watcher } from 'fsevents' ;
1616// @ts -ignore no types
@@ -139,8 +139,8 @@ class FSEventsWatcher extends EventEmitter {
139139 return false ;
140140 }
141141 return this . glob . length
142- ? micromatchSome ( relativePath , this . glob , { dot : this . dot } )
143- : this . dot || micromatchSome ( relativePath , '**/*' ) ;
142+ ? ! ! micromatch ( [ relativePath ] , this . glob , { dot : this . dot } ) . length
143+ : ! ! this . dot || micromatch ( [ relativePath ] , '**/*' ) . length ;
144144 }
145145
146146 private handleEvent ( filepath : string ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import * as path from 'path';
1010import { Config } from '@jest/types' ;
1111import { AssertionResult , SerializableError } from '@jest/test-result' ;
1212import chalk from 'chalk' ;
13- import { some as micromatchSome } from 'micromatch' ;
13+ import micromatch from 'micromatch' ;
1414import slash from 'slash' ;
1515import { codeFrameColumns } from '@babel/code-frame' ;
1616import StackUtils from 'stack-utils' ;
@@ -216,7 +216,7 @@ const formatPaths = (
216216 if (
217217 ( config . testMatch &&
218218 config . testMatch . length &&
219- micromatchSome ( filePath , config . testMatch ) ) ||
219+ micromatch ( [ filePath ] , config . testMatch ) . length ) ||
220220 filePath === relativeTestPath
221221 ) {
222222 filePath = chalk . reset . cyan ( filePath ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import * as path from 'path';
99import { Config } from '@jest/types' ;
1010import { escapePathForRegex } from 'jest-regex-util' ;
1111import { replacePathSepForGlob } from 'jest-util' ;
12- import { any as micromatchAny , some as micromatchSome } from 'micromatch' ;
12+ import micromatch , { any as micromatchAny } from 'micromatch' ;
1313import { ShouldInstrumentOptions } from './types' ;
1414
1515const MOCKS_PATTERN = new RegExp (
@@ -39,7 +39,9 @@ export default function shouldInstrument(
3939 return false ;
4040 }
4141
42- if ( micromatchSome ( replacePathSepForGlob ( filename ) , config . testMatch ) ) {
42+ if (
43+ micromatch ( [ replacePathSepForGlob ( filename ) ] , config . testMatch ) . length
44+ ) {
4345 return false ;
4446 }
4547 }
@@ -57,10 +59,10 @@ export default function shouldInstrument(
5759 // still cover if `only` is specified
5860 ! options . collectCoverageOnlyFrom &&
5961 options . collectCoverageFrom &&
60- ! micromatchSome (
61- replacePathSepForGlob ( path . relative ( config . rootDir , filename ) ) ,
62+ ! micromatch (
63+ [ replacePathSepForGlob ( path . relative ( config . rootDir , filename ) ) ] ,
6264 options . collectCoverageFrom ,
63- )
65+ ) . length
6466 ) {
6567 return false ;
6668 }
You can’t perform that action at this time.
0 commit comments