Skip to content

Commit 62e3e02

Browse files
committed
tests: adds one more watch test
1 parent 1f5567e commit 62e3e02

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

test/watch.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,43 @@ exports = module.exports = function(Gulp, util){
3939
}, done);
4040
});
4141

42-
it('watch(glob, tasks) runs `tasks` in parallel after change', function(done){
42+
it('watch(glob, tasks) runs tasks in parallel after change', function(done){
43+
var pile = [];
44+
var gulp = Gulp.create({
45+
log: false,
46+
onHandleError: done
47+
});
48+
49+
gulp.task('one', function(next){
50+
setTimeout(function(){
51+
pile.push('one');
52+
if(pile.length > 1){
53+
pile.should.containDeep(['one', 'two']);
54+
done();
55+
}
56+
next();
57+
}, Math.random() * 10);
58+
});
59+
60+
gulp.task('two', function(next){
61+
setTimeout(function(){
62+
pile.push('two');
63+
if(pile.length > 1){
64+
pile.should.containDeep(['one', 'two']);
65+
done();
66+
}
67+
next();
68+
}, Math.random() * 10);
69+
});
70+
71+
setupTest(function(){
72+
var watcher = gulp.watch(util.testFile, ['one', 'two'], function(){
73+
watcher.end();
74+
});
75+
}, done);
76+
});
77+
78+
it('watch(glob, tasks, fn) onChange fn runs after tasks', function(done){
4379
var pile = [];
4480
var gulp = Gulp.create({
4581
log: false,

0 commit comments

Comments
 (0)