37 describe('hello',function(){
38 describe('#selfFunction',function(){
39 it("should be test even if it's private",function(){
40 var rewireFunction = rewire('./private.js')
41 console.log('rewireFunction is',rewireFunction);
42 var privateFunction = rewireFunction._get_('selfFunction');
43 chai.expect(privateFunction(2)).equal(3);
44 })
45 })
46 })
如上所示代码,为什么总告诉我 _get_ 方法不存在呢?我引入了 rewire 模块了啊
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
应该是 set 和 get
是 __get__,也就是 两个下划线get两个下划线