File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {
1717 transformSync as babelTransform ,
1818} from '@babel/core' ;
1919import chalk from 'chalk' ;
20- import { escapeStrForRegex } from 'jest-regex-util' ;
20+ import { escapePathForRegex } from 'jest-regex-util' ;
2121import slash from 'slash' ;
2222
2323const THIS_FILE = fs . readFileSync ( __filename ) ;
@@ -69,7 +69,7 @@ const createTransformer = (
6969 function getRootDirRegExp ( rootDir : Config . Path ) : RegExp {
7070 if ( ! rootDirRegExpCache [ rootDir ] ) {
7171 rootDirRegExpCache [ rootDir ] = new RegExp (
72- `^${ escapeStrForRegex ( rootDir ) } (${ escapeStrForRegex ( path . sep ) } |$)` ,
72+ `^${ escapePathForRegex ( rootDir ) } (?= ${ escapePathForRegex ( path . sep ) } |$)` ,
7373 ) ;
7474 }
7575
@@ -86,7 +86,7 @@ const createTransformer = (
8686 // babel options to relativize paths
8787 return JSON . stringify ( babelOptions . options , ( _key , value ) => {
8888 if ( typeof value === 'string' ) {
89- return value . replace ( rootDirRegExp , '<rootDir>$1 ' ) ;
89+ return value . replace ( rootDirRegExp , '<rootDir>' ) ;
9090 }
9191 return value ;
9292 } ) ;
You can’t perform that action at this time.
0 commit comments