@@ -590,7 +590,6 @@ export default class Runtime {
590
590
this . setExport ( key , value ) ;
591
591
} ) ;
592
592
} ,
593
- // should identifier be `node://${moduleName}`?
594
593
{ context, identifier : moduleName } ,
595
594
) ;
596
595
@@ -599,69 +598,7 @@ export default class Runtime {
599
598
return evaluateSyntheticModule ( module ) ;
600
599
}
601
600
602
- const manualMockOrStub = this . _resolver . getMockModule ( from , moduleName ) ;
603
-
604
- let modulePath =
605
- this . _resolver . getMockModule ( from , moduleName ) ||
606
- this . _resolveModule ( from , moduleName ) ;
607
-
608
- let isManualMock =
609
- manualMockOrStub &&
610
- ! this . _resolver . resolveStubModuleName ( from , moduleName ) ;
611
- if ( ! isManualMock ) {
612
- // If the actual module file has a __mocks__ dir sitting immediately next
613
- // to it, look to see if there is a manual mock for this file.
614
- //
615
- // subDir1/my_module.js
616
- // subDir1/__mocks__/my_module.js
617
- // subDir2/my_module.js
618
- // subDir2/__mocks__/my_module.js
619
- //
620
- // Where some other module does a relative require into each of the
621
- // respective subDir{1,2} directories and expects a manual mock
622
- // corresponding to that particular my_module.js file.
623
-
624
- const moduleDir = path . dirname ( modulePath ) ;
625
- const moduleFileName = path . basename ( modulePath ) ;
626
- const potentialManualMock = path . join (
627
- moduleDir ,
628
- '__mocks__' ,
629
- moduleFileName ,
630
- ) ;
631
- if ( fs . existsSync ( potentialManualMock ) ) {
632
- isManualMock = true ;
633
- modulePath = potentialManualMock ;
634
- }
635
- }
636
- if ( isManualMock ) {
637
- const localModule : InitialModule = {
638
- children : [ ] ,
639
- exports : { } ,
640
- filename : modulePath ,
641
- id : modulePath ,
642
- loaded : false ,
643
- path : modulePath ,
644
- } ;
645
-
646
- this . _loadModule (
647
- localModule ,
648
- from ,
649
- moduleName ,
650
- modulePath ,
651
- undefined ,
652
- this . _moduleMockRegistry ,
653
- ) ;
654
-
655
- this . _moduleMockRegistry . set ( moduleID , localModule . exports ) ;
656
- } else {
657
- // Look for a real module to generate an automock from
658
- this . _moduleMockRegistry . set (
659
- moduleID ,
660
- this . _generateMock ( from , moduleName ) ,
661
- ) ;
662
- }
663
-
664
- return this . _moduleMockRegistry . get ( moduleID ) ;
601
+ throw new Error ( 'Attempting to import a mock without a factory' ) ;
665
602
}
666
603
667
604
private getExportsOfCjs ( modulePath : Config . Path ) {
0 commit comments