![](/img/trans.png)
[英]gulp-jscs seems to be unable to detect the config (.jscsrc) file, but normal jscs can from the command line
[英]gulp-jscs save report to file
是否可以運行jscs
檢查並使用jscs
並將生成的報告保存到文件中?
我希望將junit
樣式xml文件報告保存在某個地方。 我可以使用帶有>
直接命令行調用來執行此操作,但是如何使用正確的gulp來執行此操作?
您可以使用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'));
});
請注意,這將為每個JS輸入文件生成一個JUnit樣式的XML輸出文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.