我尝试测试这个类
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