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

Commit5b237d9

Browse files
committed
fix leak, add test, forjhnns#33
1 parent93d3907 commit5b237d9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎lib/rewire.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function internalRewire(parentModulePath, targetPath) {
5656

5757
// Check if the module uses the strict mode.
5858
// If so we must ensure that "use strict"; stays at the beginning of the module.
59-
src=fs.readFileSync(targetPath,"utf8");
59+
varsrc=fs.readFileSync(targetPath,"utf8");
6060
if(detectStrictMode(src)===true){
6161
prelude=' "use strict"; '+prelude;
6262
}

‎test/rewire.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ describe("rewire", function () {
3131
});
3232
expect(coffeeModule.readFileSync()).to.be("It works!");
3333
});
34+
it("should keep src variable in function scope",function(){
35+
//expect(src).to.be(undefined);
36+
// detectStrictMode();
37+
// console.dir(global);
38+
expect(global.src).to.be(undefined);
39+
});
3440
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp