Open ehaeusler opened 8 years ago
sorry for waiting.
why do you need failReporter
? the purpose of failReporter is fail when there are errors
Thats what I want it to do. If there are errors during linting, the task should fail so you are forced to fix them before recompiling. But if everything is ok, the task should continue like usual. Isn't that how you use failReporter? --- Edit --- Sorry, if that wasn't clear before: This happens when linting is successful. The task just doesn't activate again after further changes.
I can't reproduce it, sorry. Are you getting any message on the first execution?
I ran into the same issue and ended up writing a custom report function to set the process.exitCode
to 1
if there is an error:
function scsslint() {
return gulp.src(paths, {
since: gulp.lastRun('scsslint')
})
.pipe(pi.scssLint({
config: 'gulp/.scss-lint.yml',
customReport: (file) => {
var colors = pi.util.colors;
if (!file.scsslint.success) {
process.exitCode = 1;
pi.util.log(
colors.cyan(file.scsslint.issues.length) +
' issues found in ' +
colors.magenta(file.path)
);
file.scsslint.issues.forEach((issue) => {
var severity = issue.severity === 'warning' ? colors.yellow(' [W] ') : colors.red(' [E] ');
var linter = issue.linter ? (`${issue.linter}: `) : '';
var logMsg = `${colors.cyan(file.relative)}:` +
colors.magenta(issue.line) +
severity +
colors.green(linter) +
issue.reason;
pi.util.log(logMsg);
});
}
}
}));
}
gulp.task('styles:watch', () => {
gulp.watch(paths, options)
.on('change', gulp.series(
scsslint,
// other tasks
));
});
I've made a simple example of what I've tried https://github.com/juanfran/gulp-scss-lint/tree/test-bug/test-bug
I tried your example and don't run into the situation there. Maybe it's caused in combination with one of the other plugins. I'll try to isolate it and provide feedback, if I find something.
@dak If I understand you correctly, your change is based on the situation where errors do happen? Because I get no further execution after the first successfull run.
@ehaeusler It should continue to run even if warnings/errors are thrown (it won't stop the next tests from being run either). But if you're using any kind of continuous integration (like Travis CI), it will properly signal to that environment that the test failed (and if you integrate it with GitHub, can allow you to prevent merging commits with errors).
Hi there,
In my current setup (Gulp 4.0.0-alpha.2) gulp.watch stops working after the first execution if I use failReporter. The task runs successfully, but further changes don't trigger another task. Without the failReporter, the watcher works. I even tried it with the endless option, but that prevents the task from executing entirely (Shell output stops at "Starting 'styles'....).
My gulpfile: