首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何设置grunt-contrib nodeunit来输出JUnit xml?

如何设置grunt-contrib nodeunit来输出JUnit xml?
EN

Stack Overflow用户
提问于 2013-09-16 16:42:21
回答 2查看 562关注 0票数 2

我找不到任何关于如何在grunt-contrib nodeunit模块中设置reporters的信息,现在我的Gruntfile.js中有这个任务。

代码语言:javascript
复制
nodeunit: {
   all: ['nodeunit/**/*.test.js'],
}

如何告诉grunt使用自定义输出路径的内置JUnit报表?

EN

回答 2

Stack Overflow用户

发布于 2013-10-02 00:22:35

看一看你根本不能看的代码,但是你可以使用grunt-shell来做:

代码语言:javascript
复制
module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-shell');

  grunt.initConfig({
    shell:{
      nodeunit_with_junit:{
        command: './node_modules/nodeunit/bin/nodeunit --reporter junit --output ./junit_ouput tests/*.test.js',
        options:{
          stdout: true,
          stderr: true,
          failOnError:false,
          warnOnError: true
        }
      }
    }
  });

};

并用grunt shell:nodeunit_with_junit运行它。

票数 1
EN

Stack Overflow用户

发布于 2015-07-07 11:37:00

您可以在选项中设置报告器,如下所示:

代码语言:javascript
复制
    nodeunit: {
        client: ['test/unit/client/test*.js'],
        server: ['test/unit/server/test*.js'],
        options: {
            reporter: 'junit',
            reporterOptions: {
                output: '_build'
            }
        }
    },
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18823763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档