将测试日志保存到磁盘?
问题描述:
这里是我的Gruntfile:将测试日志保存到磁盘?
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
mochaTest: {
test: {
options: {
reporter: 'spec',
clearRequireCache: true,
require: ['./index.js']
},
src: ['test/**/*.coffee']
},
report: {
options: {
reporter: 'markdown',
clearRequireCache: true,
require: ['./index.js']
},
src: ['test/**/*.coffee'],
dest: './FEATURES.md'
}
},
watch: {
test: {
options: {
spawn: false,
},
files: ['src/**/*.coffee', 'test/**/*.coffee'],
tasks: ['coffee:main', 'mochaTest']
}
},
coffee: {
main: {
options: {
bare: true
},
files: [{
expand: true,
cwd: "./src",
src: ["**/*.coffee"],
dest: "./lib",
ext: ".js"
}]
},
}
});
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
// Default task(s).
grunt.registerTask('default', ['coffee:main', 'mochaTest:test', 'watch']);
grunt.registerTask('test', ['coffee:main', 'mochaTest:test']);
grunt.registerTask('report', ['coffee:main', 'mochaTest:report']);
};
当我运行grunt
对其进行测试,并报告手表作为规范,但是当我运行grunt report
它告诉我在降价的输出,虽然没有文件在项目的根目录中创建。是否有可能让markdown记者在代码标签中输出coffeescript而不是js?有没有办法通过y代码删除任何记录的输出?
答
The grunt-mocha-test插件没有dest选项。我认为你正在寻找captureFile。
要从控制台删除所有输出,您可以将安静设置为true。
这里是你的更新mochaTest:report
:
report: {
options: {
reporter: 'markdown',
clearRequireCache: true,
require: ['./index.js'],
quiet: true,
captureFile: 'FEATURES.md'
},
src: ['test/**/*.coffee']
}
非常感谢。最高的问题。有没有办法输出咖啡?* – Vinz243 2014-09-24 10:33:30
你想用** mochaTest **输出'coffee'而不是'markdown',或者这是你想要实现的东西吗? – 2014-09-24 10:35:21
GH围栏代码之间的输出代码为js。我想在咖啡:) – Vinz243 2014-09-24 10:36:16