(
preflight: TestPreflightResult,
options: { maxListedTests?: number } = {},
)
| 510 | } |
| 511 | |
| 512 | export function formatTestDiscovery( |
| 513 | preflight: TestPreflightResult, |
| 514 | options: { maxListedTests?: number } = {}, |
| 515 | ): string { |
| 516 | const maxListedTests = options.maxListedTests ?? 5; |
| 517 | const discoveredTests = collectResolvedTestSelectors(preflight); |
| 518 | |
| 519 | const listedTests = discoveredTests.slice(0, maxListedTests); |
| 520 | const remainingCount = Math.max(discoveredTests.length - listedTests.length, 0); |
| 521 | const lines = [ |
| 522 | `Resolved to ${preflight.totalTests} test(s):`, |
| 523 | ...listedTests.map((test) => ` - ${test}`), |
| 524 | ]; |
| 525 | |
| 526 | if (remainingCount > 0) { |
| 527 | lines.push(` ... and ${remainingCount} more`); |
| 528 | } |
| 529 | |
| 530 | if (preflight.completeness !== 'complete') { |
| 531 | lines.push(`Discovery completeness: ${preflight.completeness}`); |
| 532 | } |
| 533 | |
| 534 | for (const warning of preflight.warnings) { |
| 535 | lines.push(`Warning: ${warning}`); |
| 536 | } |
| 537 | |
| 538 | return lines.join('\n'); |
| 539 | } |
| 540 | |
| 541 | /** |
| 542 | * @deprecated Use formatToolPreflight + formatTestDiscovery instead. |
no test coverage detected