Return the ``**` `** ...`` section for a file basename, header through the * line before the next bold header (or end of output). Headers are bold labels, * not ATX headings (issue #778); file sections start with ``**` ``.
(text: string, basename: string)
| 39 | * line before the next bold header (or end of output). Headers are bold labels, |
| 40 | * not ATX headings (issue #778); file sections start with ``**` ``. */ |
| 41 | function sectionFor(text: string, basename: string): string { |
| 42 | const lines = text.split('\n'); |
| 43 | const start = lines.findIndex((l) => l.startsWith('**`') && l.includes(basename)); |
| 44 | if (start < 0) return ''; |
| 45 | let end = lines.length; |
| 46 | for (let i = start + 1; i < lines.length; i++) { |
| 47 | if (lines[i].startsWith('**')) { |
| 48 | end = i; |
| 49 | break; |
| 50 | } |
| 51 | } |
| 52 | return lines.slice(start, end).join('\n'); |
| 53 | } |
| 54 | |
| 55 | describe('adaptive codegraph_explore sizing — sibling skeletonization', () => { |
| 56 | let testDir: string; |
no test coverage detected