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?
Asked
Active
Viewed 107 times
1

David
- 3,190
- 8
- 25
- 31
-
Not sure if there is such a plugin already, but might not be hard to write it yourself. See e.g. [`gulp-jscs-stylish` source](https://github.com/gonsfx/gulp-jscs-stylish/blob/master/index.js) for inspiration. – Jeroen Mar 31 '16 at 05:47
1 Answers
2
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.

Sven Schoenung
- 30,224
- 8
- 65
- 70