简体   繁体   English

gulp-jscs将报告保存到文件

[英]gulp-jscs save report to file

Is there a possibility to run jscs check and using gulp and save report it produces to a file? 是否可以运行jscs检查并使用jscs并将生成的报告保存到文件中?
I want junit style xml files reports saved somewhere. 我希望将junit样式xml文件报告保存在某个地方。 I can do this using direct command line call with > but how to do it using proper gulp? 我可以使用带有>直接命令行调用来执行此操作,但是如何使用正确的gulp来执行此操作?

You can use gulp-log-capture to capture the output of gulp-jscs and write it to a file. 您可以使用gulp-log-capture捕获gulp-jscs的输出并将其写入文件。

var logCapture = require('gulp-log-capture');

gulp.task('checkstyle', () => {
  return gulp.src('*.js')
    .pipe(jscs({fix:true}))
    .pipe(logCapture.start(console, 'log'))
    .pipe(jscs.reporter('junit'))
    .pipe(logCapture.stop('xml'))
    .pipe(gulp.dest('junit-reports'));
});

Note that this will produce one JUnit-style XML output file per JS input file. 请注意,这将为每个JS输入文件生成一个JUnit样式的XML输出文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM