- If you use
run
the method will always return a Promise (the callback parameter was removed) - A task can return a Promise. If you do that it will wait until the Promise is resolved before finishing this task otherwise it will finish the task as soon as the task method finishes.
runTask
will always return a promise that will be resolved when the executed task gets called
task("lint:test:unit", function () {
run("eslint ./test/unit");
});
becomes
task("lint:test:unit", function () {
return run("eslint ./test/unit");
});
task("lint:test:unit", function () {
run("eslint ./test/unit");
run("eslint ./test/unit2");
});
becomes (if tasks can run in parallel)
task("lint:test:unit", function () {
return Pomise.All(
run("eslint ./test/unit"),
run("eslint ./test/unit2")
);
});
or (if tasks need to run in sequence)
task("lint:test:unit", function () {
return run("eslint ./test/unit")
.then(function () {
return run("eslint ./test/unit2");
});
});
task("lint:test:unit", function () {
runTask("test");
run("eslint ./test/unit2");
});
becomes (if tasks can run in parallel)
task("lint:test:unit", function () {
return Pomise.All(
runTask("test"),
run("eslint ./test/unit2")
);
});
or (if tasks need to run in sequence)
task("lint:test:unit", function () {
return runTask("test")
.then(function () {
return run("eslint ./test/unit2");
});
});