@@ -70,18 +70,22 @@ describe("rewire", function () {
7070 rewired . exportAll ( ) ;
7171 expect ( rewired . console ) . to . be ( 456 ) ;
7272 } ) ;
73- it ( "should leak private variables" , function ( ) {
73+ it ( "should leak private variables with both exports-styles (exports.bla = bla and module.exports = bla) " , function ( ) {
7474 var rewired ,
7575 leaks = [ "myPrivateVar" ] ;
7676
77- rewired = rewire ( "./testModules/A/moduleA.js" , null , null , leaks ) ;
77+ rewired = rewire ( "./testModules/privateModules/privateModuleA.js" , null , null , leaks ) ;
78+ expect ( rewired . __ . myPrivateVar ) . to . be ( "Hello I'm very private" ) ;
79+ rewired = rewire ( "./testModules/privateModules/privateModuleB.js" , null , null , leaks ) ;
7880 expect ( rewired . __ . myPrivateVar ) . to . be ( "Hello I'm very private" ) ;
7981 } ) ;
80- it ( "should leak private functions" , function ( ) {
82+ it ( "should leak private functions with both exports-styles (exports.bla = bla and module.exports = bla) " , function ( ) {
8183 var rewired ,
8284 leaks = [ "myPrivateFunction" ] ;
8385
84- rewired = rewire ( "./testModules/A/moduleA.js" , null , null , leaks ) ;
86+ rewired = rewire ( "./testModules/privateModules/privateModuleA.js" , null , null , leaks ) ;
87+ expect ( rewired . __ . myPrivateFunction ( ) ) . to . be ( "Hello I'm very private" ) ;
88+ rewired = rewire ( "./testModules/privateModules/privateModuleB.js" , null , null , leaks ) ;
8589 expect ( rewired . __ . myPrivateFunction ( ) ) . to . be ( "Hello I'm very private" ) ;
8690 } ) ;
8791 it ( "should leak nothing on demand" , function ( ) {
0 commit comments