Grunt为摩卡testing提供html报告

我使用grunt来运行我的摩卡testing,我看到在控制台的testing结果是好的,问题是这个任务正在生成报告,但是当你运行这个HTML报告,你只能看到在文本中运行的日志…我希望看到testing聚合 ,和摩卡单位testing运行好,我在这里失踪?

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是一个自定义的记者与JavaScripttesting框架,摩卡使用。 它生成一个很好的HTML / CSS报告,帮助您可视化您的testing套件:

首先,你需要安装插件:

 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' } } },