(runTime: number, estimatedTime: number, width: number)
| 52 | } |
| 53 | |
| 54 | function renderTime(runTime: number, estimatedTime: number, width: number) { |
| 55 | // If we are more than one second over the estimated time, highlight it. |
| 56 | const renderedTime = |
| 57 | estimatedTime && runTime >= estimatedTime + 1 |
| 58 | ? chalk.bold.yellow(formatTime(runTime, 0)) |
| 59 | : formatTime(runTime, 0); |
| 60 | let time = `${chalk.bold('Time:')} ${renderedTime}`; |
| 61 | if (runTime < estimatedTime) { |
| 62 | time += `, estimated ${formatTime(estimatedTime, 0)}`; |
| 63 | } |
| 64 | |
| 65 | // Only show a progress bar if the test run is actually going to take |
| 66 | // some time. |
| 67 | if (estimatedTime > 2 && runTime < estimatedTime && width) { |
| 68 | const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width); |
| 69 | const length = Math.min( |
| 70 | Math.floor((runTime / estimatedTime) * availableWidth), |
| 71 | availableWidth, |
| 72 | ); |
| 73 | if (availableWidth >= 2) { |
| 74 | time += `\n${chalk.green('█').repeat(length)}${chalk |
| 75 | .white('█') |
| 76 | .repeat(availableWidth - length)}`; |
| 77 | } |
| 78 | } |
| 79 | return time; |
| 80 | } |
| 81 | |
| 82 | export default function getSummary( |
| 83 | aggregatedResults: AggregatedResult, |
no test coverage detected