Copy a fixture tree to a fresh temp dir and index it — hermetic per run.
({ CodeGraph }, fixturePath)
| 113 | |
| 114 | /** Copy a fixture tree to a fresh temp dir and index it — hermetic per run. */ |
| 115 | async function materializeFixture({ CodeGraph }, fixturePath) { |
| 116 | const src = resolve(REPO_ROOT, fixturePath); |
| 117 | if (!existsSync(src)) throw new Error(`fixture tree not found: ${src}`); |
| 118 | const dir = mkdtempSync(join(tmpdir(), 'cg-alloc-')); |
| 119 | cpSync(src, dir, { recursive: true }); |
| 120 | // A stray index inside the checked-in tree would be copied in and reused. |
| 121 | rmSync(join(dir, '.codegraph'), { recursive: true, force: true }); |
| 122 | const cg = CodeGraph.initSync(dir); |
| 123 | await cg.indexAll(); |
| 124 | cg.close?.(); |
| 125 | return dir; |
| 126 | } |
| 127 | |
| 128 | /** Evaluate one fixture's assertions against its report. Returns check rows. */ |
| 129 | function evaluate(fixture, report, text) { |