File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ var chokidar = require('chokidar');
7
7
8
8
function Gulp ( ) {
9
9
Undertaker . call ( this ) ;
10
+
11
+ // Bind the functions for destructuring
12
+ this . watch = this . watch . bind ( this ) ;
13
+ this . task = this . task . bind ( this ) ;
14
+ this . series = this . series . bind ( this ) ;
15
+ this . parallel = this . parallel . bind ( this ) ;
16
+ this . registry = this . registry . bind ( this ) ;
17
+ this . tree = this . tree . bind ( this ) ;
18
+ this . lastRun = this . lastRun . bind ( this ) ;
10
19
}
11
20
util . inherits ( Gulp , Undertaker ) ;
12
21
Original file line number Diff line number Diff line change @@ -60,6 +60,23 @@ describe('gulp', function() {
60
60
updateTempFile ( tempFile ) ;
61
61
} ) ;
62
62
63
+ it ( 'should work with destructuring' , function ( done ) {
64
+ var tempFile = path . join ( outpath , 'watch-func.txt' ) ;
65
+ var watch = gulp . watch ;
66
+ var parallel = gulp . parallel ;
67
+ var task = gulp . task ;
68
+ createTempFile ( tempFile ) ;
69
+
70
+ task ( 'test' , function ( cb ) {
71
+ watcher . close ( ) ;
72
+ cb ( ) ;
73
+ done ( ) ;
74
+ } ) ;
75
+
76
+ var watcher = watch ( tempFile , parallel ( 'test' ) ) ;
77
+
78
+ updateTempFile ( tempFile ) ;
79
+ } ) ;
63
80
64
81
it ( 'should not call the function when no file changes: no options' , function ( done ) {
65
82
var tempFile = path . join ( outpath , 'watch-func.txt' ) ;
You can’t perform that action at this time.
0 commit comments