【发布时间】:2017-06-24 15:23:07
【问题描述】:
我尝试测试这个类
class Scraper {
async run() {
return await nightmare
.goto(this.url)
.wait('...')
.evaluate(()=>{...})
.end
}
}
我的测试是这样的:
test('Scraper test', t => {
new Scraper().run().then(() => {
t.is('test', 'test')
})
})
测试失败:
测试结束,没有运行任何断言
编辑
github 上的仓库:https://github.com/epyx25/test
测试文件:https://github.com/epyx25/test/blob/master/src/test/scraper/testScraper.test.js#L12
【问题讨论】:
标签: node.js testing promise nightmare ava