@@ -432,7 +432,7 @@ class Runtime {
432
432
'__mocks__' ,
433
433
moduleFileName ,
434
434
) ;
435
- if ( fs . existsSync ( potentialManualMock ) ) {
435
+ if ( fs . existsSync ( potentialManualMock . split ( '?' ) [ 0 ] ) ) {
436
436
isManualMock = true ;
437
437
modulePath = potentialManualMock ;
438
438
}
@@ -472,8 +472,8 @@ class Runtime {
472
472
options : InternalModuleOptions | undefined ,
473
473
moduleRegistry : ModuleRegistry ,
474
474
) {
475
- if ( path . extname ( modulePath ) === '.json' ) {
476
- const text = stripBOM ( fs . readFileSync ( modulePath , 'utf8' ) ) ;
475
+ if ( path . extname ( modulePath . split ( '?' ) [ 0 ] ) === '.json' ) {
476
+ const text = stripBOM ( fs . readFileSync ( modulePath . split ( '?' ) [ 0 ] , 'utf8' ) ) ;
477
477
478
478
const transformedFile = this . _scriptTransformer . transformJson (
479
479
modulePath ,
@@ -484,8 +484,8 @@ class Runtime {
484
484
localModule . exports = this . _environment . global . JSON . parse (
485
485
transformedFile ,
486
486
) ;
487
- } else if ( path . extname ( modulePath ) === '.node' ) {
488
- localModule . exports = require ( modulePath ) ;
487
+ } else if ( path . extname ( modulePath . split ( '?' ) [ 0 ] ) === '.node' ) {
488
+ localModule . exports = require ( modulePath . split ( '?' ) [ 0 ] ) ;
489
489
} else {
490
490
// Only include the fromPath if a moduleName is given. Else treat as root.
491
491
const fromPath = moduleName ? from : null ;
@@ -619,7 +619,7 @@ class Runtime {
619
619
if (
620
620
coveredFiles . has ( sourcePath ) &&
621
621
this . _needsCoverageMapped . has ( sourcePath ) &&
622
- fs . existsSync ( this . _sourceMapRegistry [ sourcePath ] )
622
+ fs . existsSync ( this . _sourceMapRegistry [ sourcePath ] . split ( '?' ) [ 0 ] )
623
623
) {
624
624
result [ sourcePath ] = this . _sourceMapRegistry [ sourcePath ] ;
625
625
}
0 commit comments