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