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';
12
12
import { ValidationError , validate } from 'jest-validate' ;
13
13
import { clearLine , replacePathSepForGlob } from 'jest-util' ;
14
14
import chalk from 'chalk' ;
15
- import { some as micromatchSome } from 'micromatch' ;
15
+ import micromatch from 'micromatch' ;
16
16
import { sync as realpath } from 'realpath-native' ;
17
17
import Resolver from 'jest-resolve' ;
18
18
import { replacePathSepForRegex } from 'jest-regex-util' ;
@@ -982,10 +982,10 @@ export default function normalize(
982
982
if ( newOptions . collectCoverageFrom ) {
983
983
collectCoverageFrom = collectCoverageFrom . reduce ( ( patterns , filename ) => {
984
984
if (
985
- ! micromatchSome (
986
- replacePathSepForGlob ( path . relative ( options . rootDir , filename ) ) ,
985
+ ! micromatch (
986
+ [ replacePathSepForGlob ( path . relative ( options . rootDir , filename ) ) ] ,
987
987
newOptions . collectCoverageFrom ! ,
988
- )
988
+ ) . length
989
989
) {
990
990
return patterns ;
991
991
}
Original file line number Diff line number Diff line change 6
6
*/
7
7
8
8
import * as path from 'path' ;
9
- import { some as micromatchSome } from 'micromatch' ;
9
+ import micromatch from 'micromatch' ;
10
10
import { Context } from 'jest-runtime' ;
11
11
import { Config } from '@jest/types' ;
12
12
import { Test } from 'jest-runner' ;
@@ -37,7 +37,7 @@ export type TestSelectionConfig = {
37
37
} ;
38
38
39
39
const globsToMatcher = ( globs : Array < Config . Glob > ) => ( path : Config . Path ) =>
40
- micromatchSome ( replacePathSepForGlob ( path ) , globs , { dot : true } ) ;
40
+ ! ! micromatch ( [ replacePathSepForGlob ( path ) ] , globs , { dot : true } ) . length ;
41
41
42
42
const regexToMatcher = ( testRegex : Array < string > ) => ( path : Config . Path ) =>
43
43
testRegex . some ( testRegex => new RegExp ( testRegex ) . test ( path ) ) ;
Original file line number Diff line number Diff line change 5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- import { some as micromatchSome } from 'micromatch' ;
8
+ import micromatch from 'micromatch' ;
9
9
import { replacePathSepForGlob } from 'jest-util' ;
10
10
import { Config } from '@jest/types' ;
11
11
import { FileData } from './types' ;
@@ -86,7 +86,7 @@ export default class HasteFS {
86
86
const files = new Set < string > ( ) ;
87
87
for ( const file of this . getAbsoluteFileIterator ( ) ) {
88
88
const filePath = root ? fastPath . relative ( root , file ) : file ;
89
- if ( micromatchSome ( replacePathSepForGlob ( filePath ) , globs ) ) {
89
+ if ( micromatch ( [ replacePathSepForGlob ( filePath ) ] , globs ) . length ) {
90
90
files . add ( file ) ;
91
91
}
92
92
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import * as fs from 'fs';
10
10
import * as path from 'path' ;
11
11
import { EventEmitter } from 'events' ;
12
12
import anymatch , { Matcher } from 'anymatch' ;
13
- import { some as micromatchSome } from 'micromatch' ;
13
+ import micromatch from 'micromatch' ;
14
14
// eslint-disable-next-line
15
15
import { Watcher } from 'fsevents' ;
16
16
// @ts -ignore no types
@@ -139,8 +139,8 @@ class FSEventsWatcher extends EventEmitter {
139
139
return false ;
140
140
}
141
141
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 ;
144
144
}
145
145
146
146
private handleEvent ( filepath : string ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import * as path from 'path';
10
10
import { Config } from '@jest/types' ;
11
11
import { AssertionResult , SerializableError } from '@jest/test-result' ;
12
12
import chalk from 'chalk' ;
13
- import { some as micromatchSome } from 'micromatch' ;
13
+ import micromatch from 'micromatch' ;
14
14
import slash from 'slash' ;
15
15
import { codeFrameColumns } from '@babel/code-frame' ;
16
16
import StackUtils from 'stack-utils' ;
@@ -216,7 +216,7 @@ const formatPaths = (
216
216
if (
217
217
( config . testMatch &&
218
218
config . testMatch . length &&
219
- micromatchSome ( filePath , config . testMatch ) ) ||
219
+ micromatch ( [ filePath ] , config . testMatch ) . length ) ||
220
220
filePath === relativeTestPath
221
221
) {
222
222
filePath = chalk . reset . cyan ( filePath ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import * as path from 'path';
9
9
import { Config } from '@jest/types' ;
10
10
import { escapePathForRegex } from 'jest-regex-util' ;
11
11
import { replacePathSepForGlob } from 'jest-util' ;
12
- import { any as micromatchAny , some as micromatchSome } from 'micromatch' ;
12
+ import micromatch , { any as micromatchAny } from 'micromatch' ;
13
13
import { ShouldInstrumentOptions } from './types' ;
14
14
15
15
const MOCKS_PATTERN = new RegExp (
@@ -39,7 +39,9 @@ export default function shouldInstrument(
39
39
return false ;
40
40
}
41
41
42
- if ( micromatchSome ( replacePathSepForGlob ( filename ) , config . testMatch ) ) {
42
+ if (
43
+ micromatch ( [ replacePathSepForGlob ( filename ) ] , config . testMatch ) . length
44
+ ) {
43
45
return false ;
44
46
}
45
47
}
@@ -57,10 +59,10 @@ export default function shouldInstrument(
57
59
// still cover if `only` is specified
58
60
! options . collectCoverageOnlyFrom &&
59
61
options . collectCoverageFrom &&
60
- ! micromatchSome (
61
- replacePathSepForGlob ( path . relative ( config . rootDir , filename ) ) ,
62
+ ! micromatch (
63
+ [ replacePathSepForGlob ( path . relative ( config . rootDir , filename ) ) ] ,
62
64
options . collectCoverageFrom ,
63
- )
65
+ ) . length
64
66
) {
65
67
return false ;
66
68
}
You can’t perform that action at this time.
0 commit comments