(files: Record<string, string>)
| 34 | }); |
| 35 | |
| 36 | async function index(files: Record<string, string>): Promise<CodeGraph> { |
| 37 | tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-js-work-')); |
| 38 | for (const [file, content] of Object.entries(files)) { |
| 39 | fs.mkdirSync(path.dirname(path.join(tmpDir, file)), { recursive: true }); |
| 40 | fs.writeFileSync(path.join(tmpDir, file), content); |
| 41 | } |
| 42 | cg = CodeGraph.initSync(tmpDir); |
| 43 | await cg.indexAll(); |
| 44 | return cg; |
| 45 | } |
| 46 | |
| 47 | /** How often a non-empty start of `text` was stripped as `lang`. */ |
| 48 | const strips = (lang: string, text: string) => vi.mocked(stripCommentsForRegex).mock.calls |
no test coverage detected