实习记者输出文件(如 corbertura 或 html 报告)的位置

Location of Intern reporters output files like corbertura or html report

我正在使用 Grunt with Intern 并将一些记者设置为 lcovhtmlcobertura:

grunt.initConfig({
        intern: {
            runner: {
                options: {
                    config: 'tests/intern',
                    runType: 'runner',
                    reporters: ['pretty', 'lcovhtml','junit','cobertura']
                }
            }
        },

是否有任何配置来控制所有或每个记者的这些文件的输出目录?

例如,通过将参数 reportDir 添加到 Gruntfile.js 中定义的 options 对象,您可以更新 intern/lib/reporters/lcovhtml.js 与:

define([
    'dojo/node!istanbul/lib/collector',
    'dojo/node!istanbul/lib/report/html',
    'dojo/node!istanbul/index'
], function (Collector, Reporter) {
    var collector = new Collector(),
        reporter = new Reporter();
    //...
});

与:

define([
    '../args',
    'dojo/node!istanbul/lib/collector',
    'dojo/node!istanbul/lib/report/html',
    'dojo/node!istanbul/index'
], function (args, Collector, Reporter) {
    var collector = new Collector(),
        reporter = new Reporter({ dir: args.reportDir });
    //...
});

您可以在 cobertura.jsjunit.js 记者中传播类似的更新。

注意:我在 https://github.com/theintern/intern/issues/71 中记录了这种方法。对应issue的patch暂未发布(推送到Intern 2.3)