@@ -36,21 +36,38 @@ describe('gulp', function() {
3636 createTempFile ( tempFile ) ;
3737
3838 var watcher = gulp . watch ( tempFile , function ( cb ) {
39- watcher . end ( ) ;
39+ watcher . close ( ) ;
4040 cb ( ) ;
4141 done ( ) ;
4242 } ) ;
4343
4444 updateTempFile ( tempFile ) ;
4545 } ) ;
4646
47+ it ( 'should execute the gulp.parallel tasks' , function ( done ) {
48+ var tempFile = path . join ( outpath , 'watch-func.txt' ) ;
49+
50+ createTempFile ( tempFile ) ;
51+
52+ gulp . task ( 'test' , function ( cb ) {
53+ watcher . close ( ) ;
54+ cb ( ) ;
55+ done ( ) ;
56+ } ) ;
57+
58+ var watcher = gulp . watch ( tempFile , gulp . parallel ( 'test' ) ) ;
59+
60+ updateTempFile ( tempFile ) ;
61+ } ) ;
62+
63+
4764 it ( 'should call the function when file changes: w/ options' , function ( done ) {
4865 var tempFile = path . join ( outpath , 'watch-func-options.txt' ) ;
4966
5067 createTempFile ( tempFile ) ;
5168
52- var watcher = gulp . watch ( tempFile , { debounceDelay : 5 } , function ( cb ) {
53- watcher . end ( ) ;
69+ var watcher = gulp . watch ( tempFile , function ( cb ) {
70+ watcher . close ( ) ;
5471 cb ( ) ;
5572 done ( ) ;
5673 } ) ;
@@ -66,14 +83,11 @@ describe('gulp', function() {
6683
6784 createTempFile ( tempFile ) ;
6885
69- var watcher = gulp . watch ( relFile , { debounceDelay : 5 , cwd : cwd } )
70- . on ( 'change' , function ( evt ) {
71- should . exist ( evt ) ;
72- should . exist ( evt . path ) ;
73- should . exist ( evt . type ) ;
74- evt . type . should . equal ( 'changed' ) ;
75- evt . path . should . equal ( path . resolve ( tempFile ) ) ;
76- watcher . end ( ) ;
86+ var watcher = gulp . watch ( relFile , { cwd : cwd } )
87+ . on ( 'change' , function ( filepath ) {
88+ should . exist ( filepath ) ;
89+ path . resolve ( cwd , filepath ) . should . equal ( path . resolve ( tempFile ) ) ;
90+ watcher . close ( ) ;
7791 done ( ) ;
7892 } ) ;
7993
@@ -93,12 +107,12 @@ describe('gulp', function() {
93107 gulp . task ( 'task2' , function ( cb ) {
94108 a += 10 ;
95109 a . should . equal ( 11 ) ;
96- watcher . end ( ) ;
110+ watcher . close ( ) ;
97111 cb ( ) ;
98112 done ( ) ;
99113 } ) ;
100114
101- var watcher = gulp . watch ( tempFile , { debounceDelay : 25 } , gulp . series ( 'task1' , 'task2' ) ) ;
115+ var watcher = gulp . watch ( tempFile , gulp . series ( 'task1' , 'task2' ) ) ;
102116
103117 updateTempFile ( tempFile ) ;
104118 } ) ;
@@ -116,7 +130,7 @@ describe('gulp', function() {
116130 gulp . task ( 'task2' , function ( cb ) {
117131 a += 10 ;
118132 a . should . equal ( 11 ) ;
119- watcher . end ( ) ;
133+ watcher . close ( ) ;
120134 cb ( ) ;
121135 done ( ) ;
122136 } ) ;
0 commit comments