如何设置grunt-contrib-nodeunit来输出JUnit xml?
我找不到任何信息如何在grunt-contrib-nodeunit模块中设置记者,现在我在Gruntfile.js中有这个任务。
nodeunit: { all: ['nodeunit/**/*.test.js'], }
如何告诉grunt使用内置JUnit报告与自定义输出path?
看着你的代码,你根本不能。 不过你可以使用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
运行它grunt shell:nodeunit_with_junit
。
你可以在这样的选项中设置记者:
nodeunit: { client: ['test/unit/client/test*.js'], server: ['test/unit/server/test*.js'], options: { reporter: 'junit', reporterOptions: { output: '_build' } } },