【发布时间】:2019-04-18 15:30:14
【问题描述】:
我需要在 method2 函数中添加模拟。但我收到错误
“TypeError:试图将未定义的属性method2包装为函数”
class ServiceClass {
async method1() {
}
}
async function method2() {}
module.exports = ServiceClass;
【问题讨论】:
-
你试过导出函数吗?到目前为止,您只是导出 ServiceClass,因此无法从外部访问 method2
标签: javascript testing mocha.js sinon