q.awaitAll(function(err, results) { console.log('all done', err, results); });
function add (watchGroups, onDone, testsCb) { if (!_.isArray(watchGroups)) { watchGroups = [watchGroups]; } onDone = onDone || identity; // Add this hook for testing testsCb = _.defaults({}, testsCb || {}, { onInit: identity, onEvent: identity, onCommandEvent: identity, onTaskFileEvent: identity }); var q = queue(); // Loop through each file directive watchGroups.forEach(function (watchGroup) { q.defer(processWatchGroup(testsCb), watchGroup); }); q.awaitAll(function (err, onDones) { onDone(err, onDones); }); }
/* -------------------------------------------- * General purpose error reporter * The first argument are failing errors * Second argument are warnings */ q.awaitAll(function (nS, warnings) { /* istanbul ignore if */ if (nS) { cb.fail(nS); return false; } // Send any warnings back out to report warnings.filter(nS => nS).forEach(nS => cb.warn(nS)); // And then proceed cb.proceed(); });