javascript - gulp watch only runs twice -
i'm in process of switching grunt gulp. working find under grunt (mentioning in case helps).
with gulpfile below test task (mocha) run when file changes, works twice. if change file, task run, successive changes same file don't trigger run. in other words:
- touch file a, task runs
- touch file again, task runs
- touch file again, task doesn't run
- touch file b, task runs
- touch file b again, task doesn't run
the test passes , output see gulp start/stop (i.e. i'm not seeing errors break watch)
osx 10.10.3 / gulp 3.9.0
my gulpfile:
'use strict'; var gulp = require('gulp'); var mocha = require('gulp-mocha'); gulp.task('test', function() { gulp.src('test/unit/**/*.js') .pipe(mocha()); }); gulp.task('watch', function() { gulp.watch('lib/**/*.js', ['test']); });
it's weird , don't know why same thing happened me , started working once started watching test files too. maybe work in case. give try.
gulp.task('watch', ['test'], function() { gulp.watch(['lib/**/*.js', 'test/unit/**/*.js'], ['test']); });
Comments
Post a Comment