| 340 | } |
| 341 | |
| 342 | function printHeader( |
| 343 | testName: string, |
| 344 | testIndex: number, |
| 345 | count: number, |
| 346 | type: 'setup' | 'initializer' | 'test', |
| 347 | ) { |
| 348 | const text = `(${testIndex + 1} of ${count})`; |
| 349 | const fullIndex = testIndex * nbShards + (shardId ?? 0) + 1; |
| 350 | const shard = |
| 351 | shardId === null || type !== 'test' |
| 352 | ? '' |
| 353 | : styleText( |
| 354 | ['yellow'], |
| 355 | ` [${shardId}:${nbShards}]` + styleText(['bold'], ` (${fullIndex}/${tests.length})`), |
| 356 | ); |
| 357 | console.log( |
| 358 | styleText(['green'], `Running ${type} "`) + |
| 359 | styleText(['bold', 'blue'], testName) + |
| 360 | styleText(['green'], '" ') + |
| 361 | styleText(['bold', 'white'], text) + |
| 362 | shard + |
| 363 | styleText(['green'], '...'), |
| 364 | ); |
| 365 | } |
| 366 | |
| 367 | function printFooter(testName: string, type: 'setup' | 'initializer' | 'test', startTime: number) { |
| 368 | const capsType = type[0].toUpperCase() + type.slice(1); |