0
目前,我正在使用從另一個hook
分配對象的var
。我想將其更改爲let
,但我一直在絆倒錯誤。當超出範圍時,將對象分配給let關鍵字
當前設置:
var tc;
module.exports = {
before(browser) {
tc = new func()(x, y); // needs to be assigned here.
},
'Test': function (browser) {
tc // needs to be referenced here too.
},
};
我怎樣才能將其更改爲let
尚未指派/其他掛鉤和測試案例(我使用的是摩卡)內引用它。
謝謝您的答覆。如何在'test'函數內的'tc'對象內引用一個參數? – Ben
你說這樣嗎? 'test:function(){ return this.tc.param; }' –
的種類。在'測試'中,我想將'tc'對象的參數傳遞給另一個函數。像這樣:'browser.page.function(tc.parameter,tc.anotherParameter);' – Ben