| 595 | const TEST_DISCOVERY_PREVIEW_LIMIT = 6; |
| 596 | |
| 597 | export function formatTestDiscoveryEvent(event: TestDiscoveryRenderItem): string { |
| 598 | const visibleTests = event.tests.slice(0, TEST_DISCOVERY_PREVIEW_LIMIT); |
| 599 | const lines = [`Discovered ${event.total} test(s):`]; |
| 600 | |
| 601 | for (const test of visibleTests) { |
| 602 | lines.push(` ${test}`); |
| 603 | } |
| 604 | |
| 605 | const hasMore = |
| 606 | event.truncated || |
| 607 | event.tests.length > visibleTests.length || |
| 608 | event.total > visibleTests.length; |
| 609 | |
| 610 | if (hasMore) { |
| 611 | const remainingCount = Math.max(event.total - visibleTests.length, 0); |
| 612 | lines.push(` (...and ${remainingCount} more)`); |
| 613 | } |
| 614 | |
| 615 | return lines.join('\n'); |
| 616 | } |
| 617 | |
| 618 | export function formatTestProgressEvent(event: TestProgressRenderItem): string { |
| 619 | const failWord = event.failed === 1 ? 'failure' : 'failures'; |