(file: string, name: string)
| 257 | graph = await CodeGraph.init(root, { index: true }); |
| 258 | |
| 259 | const callers = (file: string, name: string): string[] => { |
| 260 | const target = graph!.getNodesInFile(file).find((n) => n.name === name)!; |
| 261 | return graph!.getIncomingEdges(target.id) |
| 262 | .filter((e) => e.kind === 'calls') |
| 263 | .map((e) => graph!.getNode(e.source)!.name) |
| 264 | .sort(); |
| 265 | }; |
| 266 | expect(callers('src/f.ts', 'buildNote')).toEqual(['arrow', 'destr', 'inBody', 'm', 'renderWithNote']); |
| 267 | expect(callers('tool/ctl.py', 'build')).toEqual(['in_body']); |
| 268 | }, 120_000); |
no test coverage detected