Gulp 4: Watch task is executed per each matched file during startup
Created by: demisx
My versions:
gulp -v
[21:59:43] CLI version 0.4.0
[21:59:43] Local version 4.0.0-alpha.1
I have a watch task to run unit tests defined like this:
gulp.task('unit', function () {
// piping files to gulp-mocha here
...
});
gulp.task('watch:unit', function () {
gulp.watch(['app/**/*.js', '!app/**/*.spec.js'], gulp.parallel('unit'));
});
The strange behavior I'm seeing now is that when I run the gulp watch:unit
task first time it tries to run the unit
task for each matched *.js file (see the output below). I don't recall having this issue before.
$ gulp watch:unit
[22:02:20] Using gulpfile ~/projects/web-services/data-api/gulpfile.js
[22:02:20] Starting 'watch:unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
0 passing (1ms)
․
․․․[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'parallel'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
[22:02:20] Starting 'unit'...
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
0 passing (0ms)
․․․․․․․․․․
7 passing (156ms)
7 passing (125ms)