@@ -637,7 +637,6 @@ export default class Runtime {
637
637
this . setExport ( key , value ) ;
638
638
} ) ;
639
639
} ,
640
- // should identifier be `node://${moduleName}`?
641
640
{ context, identifier : moduleName } ,
642
641
) ;
643
642
@@ -646,69 +645,7 @@ export default class Runtime {
646
645
return evaluateSyntheticModule ( module ) ;
647
646
}
648
647
649
- const manualMockOrStub = this . _resolver . getMockModule ( from , moduleName ) ;
650
-
651
- let modulePath =
652
- this . _resolver . getMockModule ( from , moduleName ) ||
653
- this . _resolveModule ( from , moduleName ) ;
654
-
655
- let isManualMock =
656
- manualMockOrStub &&
657
- ! this . _resolver . resolveStubModuleName ( from , moduleName ) ;
658
- if ( ! isManualMock ) {
659
- // If the actual module file has a __mocks__ dir sitting immediately next
660
- // to it, look to see if there is a manual mock for this file.
661
- //
662
- // subDir1/my_module.js
663
- // subDir1/__mocks__/my_module.js
664
- // subDir2/my_module.js
665
- // subDir2/__mocks__/my_module.js
666
- //
667
- // Where some other module does a relative require into each of the
668
- // respective subDir{1,2} directories and expects a manual mock
669
- // corresponding to that particular my_module.js file.
670
-
671
- const moduleDir = path . dirname ( modulePath ) ;
672
- const moduleFileName = path . basename ( modulePath ) ;
673
- const potentialManualMock = path . join (
674
- moduleDir ,
675
- '__mocks__' ,
676
- moduleFileName ,
677
- ) ;
678
- if ( fs . existsSync ( potentialManualMock ) ) {
679
- isManualMock = true ;
680
- modulePath = potentialManualMock ;
681
- }
682
- }
683
- if ( isManualMock ) {
684
- const localModule : InitialModule = {
685
- children : [ ] ,
686
- exports : { } ,
687
- filename : modulePath ,
688
- id : modulePath ,
689
- loaded : false ,
690
- path : modulePath ,
691
- } ;
692
-
693
- this . _loadModule (
694
- localModule ,
695
- from ,
696
- moduleName ,
697
- modulePath ,
698
- undefined ,
699
- this . _moduleMockRegistry ,
700
- ) ;
701
-
702
- this . _moduleMockRegistry . set ( moduleID , localModule . exports ) ;
703
- } else {
704
- // Look for a real module to generate an automock from
705
- this . _moduleMockRegistry . set (
706
- moduleID ,
707
- this . _generateMock ( from , moduleName ) ,
708
- ) ;
709
- }
710
-
711
- return this . _moduleMockRegistry . get ( moduleID ) ;
648
+ throw new Error ( 'Attempting to import a mock without a factory' ) ;
712
649
}
713
650
714
651
private getExportsOfCjs ( modulePath : Config . Path ) {
0 commit comments