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

Commit983450e

Browse files
committed
Make properties writable
1 parent851c103 commit983450e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

‎lib/getDefinePropertySrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ function getDefinePropertySrc() {
1818
value+
1919
"', {enumerable: false, value: "+
2020
srcs[value]+
21-
"}); ";
21+
", "+
22+
"writable: true}); ";
2223
},"");
2324

2425
returnsrc;
2526
}
2627

27-
module.exports=getDefinePropertySrc;
28+
module.exports=getDefinePropertySrc;

‎test/testModules/sharedTestCases.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
6666
expect(rewire("./moduleB.js").__with__.toString()).to.be(__with__Src);
6767
});
6868

69-
it("should provide __set__ as a non-enumerable property",function(){
70-
expect(Object.keys(rewire("./moduleA.js")).indexOf("__set__")).to.be(-1)
71-
});
7269

73-
it("should provide __get__ as a non-enumerable property",function(){
74-
expect(Object.keys(rewire("./moduleA.js")).indexOf("__get__")).to.be(-1)
75-
});
70+
["__get__","__set__","__with__"].forEach(function(funcName){
71+
it("should provide "+funcName+" as a non-enumerable property",function(){
72+
expect(Object.keys(rewire("./moduleA.js")).indexOf(funcName)).to.be(-1)
73+
});
7674

77-
it("should provide __with__ as a non-enumerable property",function(){
78-
expect(Object.keys(rewire("./moduleA.js")).indexOf("__with__")).to.be(-1)
75+
it("should provide "+funcName+" as a writable property",function(){
76+
varobj=rewire("./moduleA.js");
77+
vardesc=Object.getOwnPropertyDescriptor(obj,funcName);
78+
expect(desc.writable).to.be(true);
79+
});
7980
});
8081

8182
it("should not influence other modules",function(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp