Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds.
(before: Files, after: Files)
| 102 | |
| 103 | /** Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds. */ |
| 104 | async function syncEdit(before: Files, after: Files): Promise<{ root: string; graph: CodeGraph; full: string[]; modified: number }> { |
| 105 | const root = tempRoot(); |
| 106 | write(root, before); |
| 107 | const graph = await index(root); |
| 108 | write(root, after); |
| 109 | const result = await graph.sync(); |
| 110 | const fullRoot = tempRoot(); |
| 111 | write(fullRoot, { ...before, ...after }); |
| 112 | const full = stateOf(fullRoot, await index(fullRoot)); |
| 113 | return { root, graph, full, modified: result.filesModified }; |
| 114 | } |
| 115 | |
| 116 | describe('sync re-links default-import readers when the module default changes', () => { |
| 117 | it('when `export default` names another declaration', async () => { |