gulpjs / undertaker

Task registry that allows composition through series/parallel methods.
MIT License
200 stars 31 forks source link

Test fails on Node v6.9.1+ #69

Closed JPeer264 closed 7 years ago

JPeer264 commented 7 years ago

In tree.js the test should form a 3 level nested tree fails as var anon = fn() is not directly an anonymous function. The name of the task is anon as the expected <anonymous>

var anon = function(cb) {
    cb();
};
taker.task('fn1', taker.parallel(anon, noop)); // anon should be <anonymous>

If you want, I can make an PR in writing the anonymous function directly in taker.parallel, this would fix the issue.

taker.task('fn1', taker.parallel(function (cb) {
    cb()
}, noop));

EDIT:

same for the last test: should use the proper labels for aliased tasks (nested)

phated commented 7 years ago

Yeah, this is something that the chrome team said they were going to be mucking with. I don't completely agree but we should look into this deeper.

JPeer264 commented 7 years ago

@phated I made a little research about this. Unfortunately there is no way around now. Functions like const anon = () => {} will never be an anonymous function anymore regarding to this.

Only two solutions would act like an anonymous function. The first one I mentioned before and:

// #2 - return an anonymous function inside
var anon = function() {
    return function(cb) {
         cb();
    };
};
taker.task('fn1', taker.parallel(anon(), noop));

For me the second solution is quite unusual, so I guess nobody will ever do that.

phated commented 7 years ago

Fixed by ffcb04412b824a50adecca4831395c32b1685ce1