@@ -36,21 +36,38 @@ describe('gulp', function() {
36
36
createTempFile ( tempFile ) ;
37
37
38
38
var watcher = gulp . watch ( tempFile , function ( cb ) {
39
- watcher . end ( ) ;
39
+ watcher . close ( ) ;
40
40
cb ( ) ;
41
41
done ( ) ;
42
42
} ) ;
43
43
44
44
updateTempFile ( tempFile ) ;
45
45
} ) ;
46
46
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
+
47
64
it ( 'should call the function when file changes: w/ options' , function ( done ) {
48
65
var tempFile = path . join ( outpath , 'watch-func-options.txt' ) ;
49
66
50
67
createTempFile ( tempFile ) ;
51
68
52
- var watcher = gulp . watch ( tempFile , { debounceDelay : 5 } , function ( cb ) {
53
- watcher . end ( ) ;
69
+ var watcher = gulp . watch ( tempFile , function ( cb ) {
70
+ watcher . close ( ) ;
54
71
cb ( ) ;
55
72
done ( ) ;
56
73
} ) ;
@@ -66,14 +83,11 @@ describe('gulp', function() {
66
83
67
84
createTempFile ( tempFile ) ;
68
85
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 ( ) ;
77
91
done ( ) ;
78
92
} ) ;
79
93
@@ -93,12 +107,12 @@ describe('gulp', function() {
93
107
gulp . task ( 'task2' , function ( cb ) {
94
108
a += 10 ;
95
109
a . should . equal ( 11 ) ;
96
- watcher . end ( ) ;
110
+ watcher . close ( ) ;
97
111
cb ( ) ;
98
112
done ( ) ;
99
113
} ) ;
100
114
101
- var watcher = gulp . watch ( tempFile , { debounceDelay : 25 } , gulp . series ( 'task1' , 'task2' ) ) ;
115
+ var watcher = gulp . watch ( tempFile , gulp . series ( 'task1' , 'task2' ) ) ;
102
116
103
117
updateTempFile ( tempFile ) ;
104
118
} ) ;
@@ -116,7 +130,7 @@ describe('gulp', function() {
116
130
gulp . task ( 'task2' , function ( cb ) {
117
131
a += 10 ;
118
132
a . should . equal ( 11 ) ;
119
- watcher . end ( ) ;
133
+ watcher . close ( ) ;
120
134
cb ( ) ;
121
135
done ( ) ;
122
136
} ) ;
0 commit comments