Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rewire.test.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/rewire.test.js b/test/rewire.test.js
index f204f7d..0524a36 100644
--- a/test/rewire.test.js
+++ b/test/rewire.test.js
@@ -16,6 +16,14 @@ describe("rewire", function () {
fs.renameSync(fakeNodeModules, path.resolve(__dirname, "testModules/node_modules"));
}
});
+ it("should keep not leak globals", function () {
+ // This test should run first, as the global space may be already polluted if
+ // require("../") is run before this test.
+ var originalGlobalKeys = Object.keys(global),
+ rewire = require("../"),
+ emptyModule = rewire("./testModules/emptyModule.js");
+ expect(Object.keys(global)).to.eql(originalGlobalKeys);
+ });
it("should pass all shared test cases", function () {
require("./testModules/sharedTestCases.js");
});
@@ -31,7 +39,4 @@ describe("rewire", function () {
});
expect(coffeeModule.readFileSync()).to.be("It works!");
});
- it("should keep src variable in function scope", function () {
- expect(global.src).to.be(undefined);
- });
}); \ No newline at end of file