如何使用摩卡生成多个报告?

我想要有以下报告:

  • 覆盖
  • 规范
  • 的xUnit

所有在我的咕噜声中执行的一个摩卡执行

目前 – 我必须运行testing3次,每次生成一个不同的报告(!)。

所以我用2个configuration的grunt-mocha-test (只有记者不同)(一次xunit-file和一次spec)。

然后我又有grunt-mocha-istanbul再次运行testing,并生成覆盖报告。

我试过使用

 { options: { reporters : ['xunit-file', 'spec'] } } 

对于grunt-mocha-test ,至less把它降到2,但这并不是工作。

阅读grunt-mocha-istanbul文档,我似乎无法find关于reporterconfiguration的任何信息。

我该如何解决这个问题?

也许这可以帮助: https : //github.com/glenjamin/mocha-multi

AFAIK摩卡尚未支持这个function,但它正在运行: https : //github.com/mochajs/mocha/pull/1360

希望这可以帮助,

捷尔吉

为了同时报告specx-unit ,还有一个名为spec-xunit-file的NPM软件包。

在咕噜:

 grunt.initConfig({ mochaTest: { test: { options: { reporter: 'spec-xunit-file', ... }, ... } } ... });