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:
authorRich Trott <rtrott@gmail.com>2014-10-28 22:49:49 +0300
committerRich Trott <rtrott@gmail.com>2014-10-28 22:49:49 +0300
commit7e25ede892de0827d6d2df71690df8cb623bde4a (patch)
treee0826e7d47da80d7597d2a8cb34ab52f184a36ee /test
parent369f2d4b76740bcdc7f14291b4621f79c7fa1ee8 (diff)
revise test to find all leaked globals
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