diff options
-rw-r--r-- | lib/rewire.js | 2 | ||||
-rw-r--r-- | test/rewire.test.js | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/rewire.js b/lib/rewire.js index e0b56f1..5644599 100644 --- a/lib/rewire.js +++ b/lib/rewire.js @@ -56,7 +56,7 @@ function internalRewire(parentModulePath, targetPath) { // Check if the module uses the strict mode. // If so we must ensure that "use strict"; stays at the beginning of the module. - src = fs.readFileSync(targetPath, "utf8"); + var src = fs.readFileSync(targetPath, "utf8"); if (detectStrictMode(src) === true) { prelude = ' "use strict"; ' + prelude; } diff --git a/test/rewire.test.js b/test/rewire.test.js index 1ac0129..57e37be 100644 --- a/test/rewire.test.js +++ b/test/rewire.test.js @@ -31,4 +31,10 @@ describe("rewire", function () { }); expect(coffeeModule.readFileSync()).to.be("It works!"); }); + it("should keep src variable in function scope", function () { + //expect(src).to.be(undefined); + // detectStrictMode(); + // console.dir(global); + expect(global.src).to.be(undefined); + }); });
\ No newline at end of file |