@@ -661,7 +661,6 @@ export default class Runtime {
661661 this . setExport ( key , value ) ;
662662 } ) ;
663663 } ,
664- // should identifier be `node://${moduleName}`?
665664 { context, identifier : moduleName } ,
666665 ) ;
667666
@@ -670,69 +669,7 @@ export default class Runtime {
670669 return evaluateSyntheticModule ( module ) ;
671670 }
672671
673- const manualMockOrStub = this . _resolver . getMockModule ( from , moduleName ) ;
674-
675- let modulePath =
676- this . _resolver . getMockModule ( from , moduleName ) ||
677- this . _resolveModule ( from , moduleName ) ;
678-
679- let isManualMock =
680- manualMockOrStub &&
681- ! this . _resolver . resolveStubModuleName ( from , moduleName ) ;
682- if ( ! isManualMock ) {
683- // If the actual module file has a __mocks__ dir sitting immediately next
684- // to it, look to see if there is a manual mock for this file.
685- //
686- // subDir1/my_module.js
687- // subDir1/__mocks__/my_module.js
688- // subDir2/my_module.js
689- // subDir2/__mocks__/my_module.js
690- //
691- // Where some other module does a relative require into each of the
692- // respective subDir{1,2} directories and expects a manual mock
693- // corresponding to that particular my_module.js file.
694-
695- const moduleDir = path . dirname ( modulePath ) ;
696- const moduleFileName = path . basename ( modulePath ) ;
697- const potentialManualMock = path . join (
698- moduleDir ,
699- '__mocks__' ,
700- moduleFileName ,
701- ) ;
702- if ( fs . existsSync ( potentialManualMock ) ) {
703- isManualMock = true ;
704- modulePath = potentialManualMock ;
705- }
706- }
707- if ( isManualMock ) {
708- const localModule : InitialModule = {
709- children : [ ] ,
710- exports : { } ,
711- filename : modulePath ,
712- id : modulePath ,
713- loaded : false ,
714- path : modulePath ,
715- } ;
716-
717- this . _loadModule (
718- localModule ,
719- from ,
720- moduleName ,
721- modulePath ,
722- undefined ,
723- this . _moduleMockRegistry ,
724- ) ;
725-
726- this . _moduleMockRegistry . set ( moduleID , localModule . exports ) ;
727- } else {
728- // Look for a real module to generate an automock from
729- this . _moduleMockRegistry . set (
730- moduleID ,
731- this . _generateMock ( from , moduleName ) ,
732- ) ;
733- }
734-
735- return this . _moduleMockRegistry . get ( moduleID ) ;
672+ throw new Error ( 'Attempting to import a mock without a factory' ) ;
736673 }
737674
738675 private getExportsOfCjs ( modulePath : Config . Path ) {
0 commit comments