[英]Grunt provide html report for mocha test
我使用grunt来运行我的摩卡测试,并且在控制台中看到了测试结果,这是可以的,问题是此任务正在生成报告,但是当您运行此HTML报告时,您只会看到以文本形式运行的日志...我想查看测试聚合 ,并且摩卡单元测试运行正常,我在这里缺少什么?
mochaTest: {
test: {
options: {
reporter: 'spec',
colors: true,
summery: true,
captureFile: 'results.html', // Optionally capture the reporter output to a file
quiet: false, // Optionally suppress output to standard out (defaults to false)
clearRequireCache: true // Optionally clear the require cache before running tests (defaults to false)
},
src: ['test/*spec.js'],
excludes: ['plugins']
},
'travis-cov': {
options: {
reporter: 'travis-cov'
}
}
},
我使用包grunt.loadNpmTasks('grunt-mocha-test');
https://github.com/pghalliday/grunt-mocha-test
我想要这样的报告或我可以使用的任何其他漂亮的HTML报告...
您可以使用Mochawesome是一个自定义报告程序,可与Javascript测试框架mocha一起使用。 它会生成一个不错的HTML / CSS报告,有助于可视化您的测试套件:
首先,您需要安装插件:
npm install --save-dev mochawesome
然后,您更改您的grunt-mocha-test
reporter
:
mochaTest: {
test: {
options: {
reporter: 'mochawesome', //You need to change this !
colors: true,
summery: true,
captureFile: 'results.html',
quiet: false,
clearRequireCache: true
},
src: ['test/*spec.js'],
excludes: ['plugins']
},
'travis-cov': {
options: {
reporter: 'travis-cov'
}
}
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.