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');
77
88function Gulp ( ) {
99 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 ) ;
1019}
1120util . inherits ( Gulp , Undertaker ) ;
1221
Original file line number Diff line number Diff line change @@ -60,6 +60,23 @@ describe('gulp', function() {
6060 updateTempFile ( tempFile ) ;
6161 } ) ;
6262
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+ } ) ;
6380
6481 it ( 'should not call the function when no file changes: no options' , function ( done ) {
6582 var tempFile = path . join ( outpath , 'watch-func.txt' ) ;
You can’t perform that action at this time.
0 commit comments