File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ implicitGlobal = "this is an implicit global var ..." +
2
+ "yes, it's bad coding style but there are still some libs out there" ;
Original file line number Diff line number Diff line change @@ -248,6 +248,16 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
248
248
}
249
249
} ) ;
250
250
251
+ it ( "should be possible to set implicit globals" , function ( ) {
252
+ var implicitGlobalModule = rewire ( "./implicitGlobal.js" ) ;
253
+
254
+ implicitGlobalModule . __set__ ( "implicitGlobal" , true ) ;
255
+ expect ( implicitGlobalModule . __get__ ( "implicitGlobal" ) ) . to . be ( true ) ;
256
+ // setting implicit global vars will change them globally instead of locally.
257
+ // that's a shortcoming of the current implementation which can't be solved easily.
258
+ //expect(implicitGlobal).to.be.a("string");
259
+ } ) ;
260
+
251
261
it ( "should throw a TypeError if the path is not a string" , function ( ) {
252
262
expect ( function ( ) {
253
263
rewire ( null ) ;
You can’t perform that action at this time.
0 commit comments