@@ -795,7 +795,6 @@ export default class Runtime {
795
795
this . setExport ( key , value ) ;
796
796
} ) ;
797
797
} ,
798
- // should identifier be `node://${moduleName}`?
799
798
{ context, identifier : moduleName } ,
800
799
) ;
801
800
@@ -804,69 +803,7 @@ export default class Runtime {
804
803
return evaluateSyntheticModule ( module ) ;
805
804
}
806
805
807
- const manualMockOrStub = this . _resolver . getMockModule ( from , moduleName ) ;
808
-
809
- let modulePath =
810
- this . _resolver . getMockModule ( from , moduleName ) ||
811
- this . _resolveModule ( from , moduleName ) ;
812
-
813
- let isManualMock =
814
- manualMockOrStub &&
815
- ! this . _resolver . resolveStubModuleName ( from , moduleName ) ;
816
- if ( ! isManualMock ) {
817
- // If the actual module file has a __mocks__ dir sitting immediately next
818
- // to it, look to see if there is a manual mock for this file.
819
- //
820
- // subDir1/my_module.js
821
- // subDir1/__mocks__/my_module.js
822
- // subDir2/my_module.js
823
- // subDir2/__mocks__/my_module.js
824
- //
825
- // Where some other module does a relative require into each of the
826
- // respective subDir{1,2} directories and expects a manual mock
827
- // corresponding to that particular my_module.js file.
828
-
829
- const moduleDir = path . dirname ( modulePath ) ;
830
- const moduleFileName = path . basename ( modulePath ) ;
831
- const potentialManualMock = path . join (
832
- moduleDir ,
833
- '__mocks__' ,
834
- moduleFileName ,
835
- ) ;
836
- if ( fs . existsSync ( potentialManualMock ) ) {
837
- isManualMock = true ;
838
- modulePath = potentialManualMock ;
839
- }
840
- }
841
- if ( isManualMock ) {
842
- const localModule : InitialModule = {
843
- children : [ ] ,
844
- exports : { } ,
845
- filename : modulePath ,
846
- id : modulePath ,
847
- loaded : false ,
848
- path : modulePath ,
849
- } ;
850
-
851
- this . _loadModule (
852
- localModule ,
853
- from ,
854
- moduleName ,
855
- modulePath ,
856
- undefined ,
857
- this . _moduleMockRegistry ,
858
- ) ;
859
-
860
- this . _moduleMockRegistry . set ( moduleID , localModule . exports ) ;
861
- } else {
862
- // Look for a real module to generate an automock from
863
- this . _moduleMockRegistry . set (
864
- moduleID ,
865
- this . _generateMock ( from , moduleName ) ,
866
- ) ;
867
- }
868
-
869
- return this . _moduleMockRegistry . get ( moduleID ) ;
806
+ throw new Error ( 'Attempting to import a mock without a factory' ) ;
870
807
}
871
808
872
809
private getExportsOfCjs ( modulePath : string ) {
0 commit comments