(context)
| 83 | } |
| 84 | |
| 85 | run(context) { |
| 86 | this.render(); |
| 87 | |
| 88 | context = context || Object.create(null); |
| 89 | |
| 90 | const errors = []; |
| 91 | |
| 92 | this._checkAll(context); |
| 93 | |
| 94 | const tasks = pMap(this._tasks, task => { |
| 95 | this._checkAll(context); |
| 96 | return runTask(task, context, errors); |
| 97 | }, {concurrency: this.concurrency}); |
| 98 | |
| 99 | return tasks |
| 100 | .then(() => { |
| 101 | if (errors.length > 0) { |
| 102 | const err = new ListrError('Something went wrong'); |
| 103 | err.errors = errors; |
| 104 | throw err; |
| 105 | } |
| 106 | |
| 107 | this._renderer.end(); |
| 108 | |
| 109 | return context; |
| 110 | }) |
| 111 | .catch(error => { |
| 112 | error.context = context; |
| 113 | this._renderer.end(error); |
| 114 | throw error; |
| 115 | }); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | module.exports = Listr; |
no test coverage detected