I did it using gulp.start(); like this:
gulp.task('test1', function(){
gulp.start('test2');
})
gulp.task('test2', function(){
// do something
})
I was using gulp 3.9.1 if it matters. Looks like gulp.start() may be removed or deprecated; but it hasn’t happened yet.
Update
If I were to break things out into separate functions, as Novellizator suggested, it would be something like this:
function doSomething(){
// do something
}
gulp.task('test1', function(){
doSomething();
})
gulp.task('test2', function(){
doSomething();
})
It is simple and avoids the use of gulp.start().