* Index `files`, rewrite one of them, sync, and return the callers of `name` * before the edit, after the sync, and from a fresh index of the edited tree * — the answer a synced index must agree with.
(
files: Record<string, string>,
include: string[],
editPath: string,
edited: string,
name: string
)
| 901 | * — the answer a synced index must agree with. |
| 902 | */ |
| 903 | async function editAndSync( |
| 904 | files: Record<string, string>, |
| 905 | include: string[], |
| 906 | editPath: string, |
| 907 | edited: string, |
| 908 | name: string |
| 909 | ) { |
| 910 | const { dir, cg } = await indexProject(files, include); |
| 911 | const before = callersOf(cg, name); |
| 912 | fs.writeFileSync(path.join(dir, editPath), edited); |
| 913 | const result = await cg.sync(); |
| 914 | expect(result.filesModified).toBe(1); |
| 915 | const fresh = await indexProject({ ...files, [editPath]: edited }, include); |
| 916 | return { before, synced: callersOf(cg, name), fresh: callersOf(fresh.cg, name) }; |
| 917 | } |
| 918 | |
| 919 | const tsOps = [ |
| 920 | `export class Foo {`, |
no test coverage detected