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