(payload: unknown)
| 452 | * dort ist "keine Liste" ein anderer Satz als "leere Liste". |
| 453 | */ |
| 454 | export function readIndexStatusCoverage(payload: unknown): IndexStatusCoverage { |
| 455 | const raw = isRecord(payload) ? payload : {}; |
| 456 | const partial = isRecord(raw['parse_partial']) ? raw['parse_partial'] : {}; |
| 457 | const skipped = isRecord(raw['skipped']) ? raw['skipped'] : {}; |
| 458 | const notIndexed = isRecord(raw['not_indexed']) ? raw['not_indexed'] : {}; |
| 459 | |
| 460 | const partialFiles: PartialFileEntry[] = []; |
| 461 | for (const entry of coverageArray(partial['files'])) { |
| 462 | if (!isRecord(entry)) { |
| 463 | continue; |
| 464 | } |
| 465 | const path = normalizeCoveragePath(coverageString(entry['path'])); |
| 466 | if (path.length > 0) { |
| 467 | partialFiles.push({ path, errorRanges: coverageString(entry['error_ranges']) }); |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | const skippedFiles: SkippedFileEntry[] = []; |
| 472 | for (const entry of coverageArray(skipped['files'])) { |
| 473 | if (!isRecord(entry)) { |
| 474 | continue; |
| 475 | } |
| 476 | const path = normalizeCoveragePath(coverageString(entry['path'])); |
| 477 | if (path.length > 0) { |
| 478 | skippedFiles.push({ |
| 479 | path, |
| 480 | reason: coverageString(entry['reason']), |
| 481 | phase: coverageString(entry['phase']), |
| 482 | }); |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | const notIndexedDirs: string[] = []; |
| 487 | for (const entry of coverageArray(notIndexed['dirs'])) { |
| 488 | const path = normalizeCoveragePath(coverageString(entry)); |
| 489 | if (path.length > 0) { |
| 490 | notIndexedDirs.push(path); |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | const notIndexedFiles: NotIndexedFileEntry[] = []; |
| 495 | for (const entry of coverageArray(notIndexed['files'])) { |
| 496 | if (!isRecord(entry)) { |
| 497 | continue; |
| 498 | } |
| 499 | const path = normalizeCoveragePath(coverageString(entry['path'])); |
| 500 | if (path.length > 0) { |
| 501 | notIndexedFiles.push({ path, reason: coverageString(entry['reason']) }); |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | return { |
| 506 | ...(coverageString(raw['indexed_at']) ? { generation: coverageString(raw['indexed_at']) } : {}), |
| 507 | parsePartial: partialFiles, |
| 508 | parsePartialCount: asNumber(partial['count']), |
| 509 | parsePartialTruncated: partial['truncated'] === true, |
| 510 | skipped: skippedFiles, |
| 511 | skippedCount: asNumber(skipped['count']), |
no test coverage detected