@@ -10,6 +10,11 @@ define("local-side-effect", function () {
1010 } ;
1111} ) ;
1212
13+ define ( "local-module-non-object" , [ "local-side-effect" ] , function ( sideEffect ) {
14+ sideEffect . foo = "bar"
15+ return 1 ;
16+ } ) ;
17+
1318it ( "should create dependency when require is called with 'new' (object export)" , function ( ) {
1419 const result = new require ( "./object-export" ) ;
1520 result . foo . should . equal ( "bar" ) ;
@@ -22,17 +27,27 @@ it("should create dependency when require is called with 'new' (non-object expor
2227 sideEffect . foo . should . equal ( "bar" ) ;
2328} ) ;
2429
25- it ( "should create dependency when with a local dependency (object export)" , function ( ) {
30+ it ( "should create dependency with 'new' on a local dependency (object export)" , function ( ) {
2631 const result = new require ( "local-module-object" ) ;
2732 result . foo . should . equal ( "bar" ) ;
2833} ) ;
2934
30- it ( "should work within parentheses" , function ( ) {
35+ it ( "shouldn't fail with a local dependency (non-object export)" , function ( ) {
36+ const sideEffect = require ( "local-side-effect" ) ;
37+ new require ( "local-module-non-object" ) ;
38+ sideEffect . foo . should . equal ( "bar" ) ;
39+ } ) ;
40+
41+ it ( "should work with 'require' in parentheses" , function ( ) {
3142 const result = new ( require ) ( "./object-export" ) ;
3243 result . foo . should . equal ( "bar" ) ;
3344} ) ;
3445
35- it ( "should work with local module in parentheses" , function ( ) {
46+ it ( "should work with local module 'require' in parentheses" , function ( ) {
3647 const result = new ( require ) ( "local-module-object" ) ;
3748 result . foo . should . equal ( "bar" ) ;
3849} ) ;
50+
51+ it ( "shouldn't fail with non-object local module 'require' in parentheses" , function ( ) {
52+ new ( require ) ( "local-module-non-object" ) ;
53+ } ) ;
0 commit comments