(
records: Map<string, CoverageRecord>,
entry: { path: string; kind: 'file' | 'dir'; state: CoverageState; reason: string; source: string },
)
| 718 | }; |
| 719 | |
| 720 | function putRecord( |
| 721 | records: Map<string, CoverageRecord>, |
| 722 | entry: { path: string; kind: 'file' | 'dir'; state: CoverageState; reason: string; source: string }, |
| 723 | ): void { |
| 724 | const path = normalizeCoveragePath(entry.path); |
| 725 | if (path.length === 0) { |
| 726 | return; |
| 727 | } |
| 728 | const existing = records.get(path); |
| 729 | if (existing === undefined) { |
| 730 | records.set(path, { |
| 731 | path, |
| 732 | kind: entry.kind, |
| 733 | state: entry.state, |
| 734 | reason: entry.reason, |
| 735 | sources: [entry.source], |
| 736 | }); |
| 737 | return; |
| 738 | } |
| 739 | if (!existing.sources.includes(entry.source)) { |
| 740 | existing.sources.push(entry.source); |
| 741 | } |
| 742 | // Ein Ordner bleibt ein Ordner: die Scope-Liste nennt Pfade ohne Art, und |
| 743 | // eine Datei daraus duerfte einen bekannten Ordner nicht ueberschreiben. |
| 744 | if (entry.kind === 'dir') { |
| 745 | existing.kind = 'dir'; |
| 746 | } |
| 747 | const worst = worstCoverage(existing.state, entry.state); |
| 748 | if (worst !== existing.state) { |
| 749 | existing.state = worst; |
| 750 | existing.reason = entry.reason; |
| 751 | } else if (existing.reason.length === 0) { |
| 752 | existing.reason = entry.reason; |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * Die Quellen zu einem Befund je Pfad zusammenlegen. |
no test coverage detected