File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ var srcs = {
19
19
function internalRewire ( parentModulePath , targetPath ) {
20
20
var targetModule ,
21
21
prelude ,
22
- appendix ;
22
+ appendix ,
23
+ src ;
23
24
24
25
// Checking params
25
26
if ( typeof targetPath !== "string" ) {
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ describe("rewire", function () {
16
16
fs . renameSync ( fakeNodeModules , path . resolve ( __dirname , "testModules/node_modules" ) ) ;
17
17
}
18
18
} ) ;
19
+ it ( "should keep not leak globals" , function ( ) {
20
+ // This test should run first, as the global space may be already polluted if
21
+ // require("../") is run before this test.
22
+ var originalGlobalKeys = Object . keys ( global ) ,
23
+ rewire = require ( "../" ) ,
24
+ emptyModule = rewire ( "./testModules/emptyModule.js" ) ;
25
+ expect ( Object . keys ( global ) ) . to . eql ( originalGlobalKeys ) ;
26
+ } ) ;
19
27
it ( "should pass all shared test cases" , function ( ) {
20
28
require ( "./testModules/sharedTestCases.js" ) ;
21
29
} ) ;
You can’t perform that action at this time.
0 commit comments