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

标签 javascript node.js unit-testing gruntjs nodeunit

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

nodeunit: {
   all: ['nodeunit/**/*.test.js'],
}

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

最佳答案

看看代码你根本做不到。但是你可以使用 grunt-shell 这样做:

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 运行它。

关于javascript - 如何设置 grunt-contrib-nodeunit 输出 JUnit xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18823763/

相关文章:

javascript - 从文本框中获取字符串并应用于字符串属性

javascript - 如何在 Express 中修复此 ES6 promise 链?

javascript - 随机报价机 - 如何避免报价重复

node.js - 如何在 npm start 时将 Nodemon 与 Express JS 一起使用?

node.js - 如何为用户需要登录的网页编写单元测试

javascript - 链接 D3.js 转换的差异

javascript - Electron 的本地存储未在动态创建的元素上保存我的点击事件

javascript - 在 Node.js 中的函数和 JavaScript 文件之间隐式传递上下文

c# - 如何在 VB.Net 中声明 lambda 事件处理程序?

java - SPOCK:如何模拟供应商行为