diff --git a/tools/task-runner/run-task-verbose-formater.js b/tools/task-runner/run-task-verbose-formater.js index e3567a1006cc..faff4700703e 100644 --- a/tools/task-runner/run-task-verbose-formater.js +++ b/tools/task-runner/run-task-verbose-formater.js @@ -12,37 +12,34 @@ const log = (title, parents, message = '') => { const render = (tasks, parents = []) => { // eslint-disable-next-line no-restricted-syntax for (const task of tasks) { - task.subscribe(event => { - if (event.type === 'SUBTASKS') { - render(task.subtasks, parents.concat([task.title])); - return; + task.on('SUBTASKS', event => { + render(task.subtasks, parents.concat([task.title])); + }); + task.on('STATE', event => { + if (task.isPending()) { + log(task.title, parents, chalk.dim('...')); + } + if (task.hasFailed()) { + log(task.title, parents, chalk.red(figures.cross)); } - if (event.type === 'STATE') { - if (task.isPending()) { - log(task.title, parents, chalk.dim('...')); - } - if (task.hasFailed()) { - log(task.title, parents, chalk.red(figures.cross)); - } - if (task.isSkipped()) { - log( - task.title, - parents, - `${chalk.dim(figures.arrowDown)} (${task.output})` - ); - } - if ( - task.isCompleted() && - !task.hasFailed() && - !task.isSkipped() - ) { - log(task.title, parents, chalk.dim.green(figures.tick)); - } + if (task.isSkipped()) { + log( + task.title, + parents, + `${chalk.dim(figures.arrowDown)} (${task.output})` + ); } - if (event.type === 'DATA') { - console.log(event.data); + if ( + task.isCompleted() && + !task.hasFailed() && + !task.isSkipped() + ) { + log(task.title, parents, chalk.dim.green(figures.tick)); } }); + task.on('DATA', event => { + console.log(event.data); + }); } };