Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e25ede

Browse files
committed
revise test to find all leaked globals
1 parent369f2d4 commit7e25ede

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎test/rewire.test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ describe("rewire", function () {
1616
fs.renameSync(fakeNodeModules,path.resolve(__dirname,"testModules/node_modules"));
1717
}
1818
});
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+
varoriginalGlobalKeys=Object.keys(global),
23+
rewire=require("../"),
24+
emptyModule=rewire("./testModules/emptyModule.js");
25+
expect(Object.keys(global)).to.eql(originalGlobalKeys);
26+
});
1927
it("should pass all shared test cases",function(){
2028
require("./testModules/sharedTestCases.js");
2129
});
@@ -31,7 +39,4 @@ describe("rewire", function () {
3139
});
3240
expect(coffeeModule.readFileSync()).to.be("It works!");
3341
});
34-
it("should keep src variable in function scope",function(){
35-
expect(global.src).to.be(undefined);
36-
});
3742
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp