File tree 2 files changed +6
-6
lines changed
packages/jest-runtime/src
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ export default class ScriptTransformer {
301
301
const isInternalModule = ! ! ( options && options . isInternalModule ) ;
302
302
const isCoreModule = ! ! ( options && options . isCoreModule ) ;
303
303
const content = stripShebang (
304
- fileSource || fs . readFileSync ( filename , 'utf8' ) ,
304
+ fileSource || fs . readFileSync ( filename . split ( '?' ) [ 0 ] , 'utf8' ) ,
305
305
) ;
306
306
307
307
let wrappedCode : string ;
@@ -513,7 +513,7 @@ const readCacheFile = (cachePath: Path): ?string => {
513
513
} ;
514
514
515
515
const getScriptCacheKey = ( filename , instrument : boolean ) => {
516
- const mtime = fs . statSync ( filename ) . mtime ;
516
+ const mtime = fs . statSync ( filename . split ( '?' ) [ 0 ] ) . mtime ;
517
517
return filename + '_' + mtime . getTime ( ) + ( instrument ? '_instrumented' : '' ) ;
518
518
} ;
519
519
Original file line number Diff line number Diff line change @@ -343,9 +343,9 @@ class Runtime {
343
343
loaded : false ,
344
344
} ;
345
345
moduleRegistry [ modulePath ] = localModule ;
346
- if ( path . extname ( modulePath ) === '.json' ) {
346
+ if ( path . extname ( modulePath . split ( '?' ) [ 0 ] ) === '.json' ) {
347
347
localModule . exports = this . _environment . global . JSON . parse (
348
- stripBOM ( fs . readFileSync ( modulePath , 'utf8' ) ) ,
348
+ stripBOM ( fs . readFileSync ( modulePath . split ( '?' ) [ 0 ] , 'utf8' ) ) ,
349
349
) ;
350
350
} else if (path.extname(modulePath) === '.node') {
351
351
// $FlowFixMe
@@ -413,7 +413,7 @@ class Runtime {
413
413
'__mocks__' ,
414
414
moduleFileName ,
415
415
) ;
416
- if ( fs . existsSync ( potentialManualMock ) ) {
416
+ if ( fs . existsSync ( potentialManualMock . split ( '?' ) [ 0 ] ) ) {
417
417
manualMock = true ;
418
418
modulePath = potentialManualMock ;
419
419
}
@@ -511,7 +511,7 @@ class Runtime {
511
511
if (
512
512
coveredFiles . has ( sourcePath ) &&
513
513
this . _needsCoverageMapped . has ( sourcePath ) &&
514
- fs . existsSync ( this . _sourceMapRegistry [ sourcePath ] )
514
+ fs . existsSync ( this . _sourceMapRegistry [ sourcePath ] . split ( '?' ) [ 0 ] )
515
515
) {
516
516
result [ sourcePath ] = this . _sourceMapRegistry [ sourcePath ] ;
517
517
}
You can’t perform that action at this time.
0 commit comments