使用助手 class 中的 this.currentTestState
use this.currentTestState from helper class
我想使用助手 class 中的 this.currentTest.state
,而不是在我的测试文件中。但是我得到 Property 'currentTest' does not exist on type HelperClass.
在另一个 class 中使用 this.currentTest.state
的正确方法是什么?
助手Class:
export class HelperClass {
public getSource() {
const state = this.currentTest.state;
if (state !== 'passed') {
// do this
}
测试文件:
afterEach(async () => {
await helperClass.getSource();
});
类似问题请参考这里
state
值应从您的规范文件中传递。
我想使用助手 class 中的 this.currentTest.state
,而不是在我的测试文件中。但是我得到 Property 'currentTest' does not exist on type HelperClass.
在另一个 class 中使用 this.currentTest.state
的正确方法是什么?
助手Class:
export class HelperClass {
public getSource() {
const state = this.currentTest.state;
if (state !== 'passed') {
// do this
}
测试文件:
afterEach(async () => {
await helperClass.getSource();
});
类似问题请参考这里
state
值应从您的规范文件中传递。