@@ -48,19 +48,15 @@ describe('ConstructionStrategyCommonJs', () => {
48
48
if ( path === 'mainmodulepath/unknown.js' ) {
49
49
return ;
50
50
}
51
- return true ;
52
- } ) ;
53
- req . main = < any > {
54
- require ( path : string ) {
55
- if ( path === 'othermodule' ) {
56
- return requireOther ;
57
- }
58
- if ( Path . join ( process . cwd ( ) , 'myfile.js' ) ) {
59
- return requireFile ;
60
- }
61
- throw new Error ( `Main require not found for ${ path } ` ) ;
62
- } ,
63
- } ;
51
+ if ( path === 'othermodule' ) {
52
+ return requireOther ;
53
+ }
54
+ if ( Path . join ( process . cwd ( ) , 'myfile.js' ) ) {
55
+ return requireFile ;
56
+ }
57
+ throw new Error ( `Require not found for ${ path } ` ) ;
58
+ } ) ;
59
+ req . resolve = < any > ( ( arg : string ) => arg ) ;
64
60
moduleState = {
65
61
componentModules : { } ,
66
62
contexts : { } ,
@@ -175,19 +171,6 @@ describe('ConstructionStrategyCommonJs', () => {
175
171
} ) ) . toThrow ( new Error ( 'Failed to get module element a.X from module currentmodule' ) ) ;
176
172
} ) ;
177
173
178
- it ( 'without requireElement and constructor in another module with undefined req.main should throw' , ( ) => {
179
- req . main = undefined ;
180
- expect ( ( ) => constructionStrategy . createInstance ( {
181
- settings,
182
- moduleState,
183
- requireName : 'othermodule' ,
184
- requireElement : undefined ,
185
- callConstructor : false ,
186
- args : [ ] ,
187
- instanceId : 'myinstance' ,
188
- } ) ) . toThrow ( new Error ( `Corrupt Node.js state: Could not find a main module.` ) ) ;
189
- } ) ;
190
-
191
174
it ( 'with requireElement to class and without constructor in the current module' , ( ) => {
192
175
expect ( constructionStrategy . createInstance ( {
193
176
settings,
0 commit comments