(options)
| 23 | } |
| 24 | |
| 25 | run(options) { |
| 26 | let ui = this.ui; |
| 27 | let testem = this.testem; |
| 28 | let task = this; |
| 29 | |
| 30 | // The building has actually started already, but we want some output while we wait for the server |
| 31 | |
| 32 | return new Promise((resolve, reject) => { |
| 33 | if (options.path) { |
| 34 | resolve(task.invokeTestem(options)); |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | ui.startProgress(chalk.green('Building'), chalk.green('.')); |
| 39 | |
| 40 | let watcher = options.watcher; |
| 41 | let started = false; |
| 42 | |
| 43 | // Wait for a build and then either start or restart testem |
| 44 | watcher.on('change', () => { |
| 45 | try { |
| 46 | if (started) { |
| 47 | testem.restart(); |
| 48 | } else { |
| 49 | started = true; |
| 50 | |
| 51 | ui.stopProgress(); |
| 52 | resolve(task.invokeTestem(options)); |
| 53 | } |
| 54 | } catch (e) { |
| 55 | reject(e); |
| 56 | } |
| 57 | }); |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Exit silently |
nothing calls this directly
no test coverage detected