简体   繁体   中英

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?
I want junit style xml files reports saved somewhere. I can do this using direct command line call with > but how to do it using proper gulp?

You can use gulp-log-capture to capture the output of gulp-jscs and write it to a file.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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