[英]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.