`kind` edges leaving `fnName` in `file`, as `name@file` of each target.
(fnName: string, file: string, kind: 'calls' | 'imports')
| 39 | |
| 40 | /** `kind` edges leaving `fnName` in `file`, as `name@file` of each target. */ |
| 41 | function targets(fnName: string, file: string, kind: 'calls' | 'imports'): string[] { |
| 42 | const src = cg! |
| 43 | .getNodesInFile(file) |
| 44 | .find((n) => n.name === fnName && (n.kind === 'function' || n.kind === 'file')); |
| 45 | expect(src, `${fnName} in ${file}`).toBeDefined(); |
| 46 | return cg! |
| 47 | .getOutgoingEdges(src!.id) |
| 48 | .filter((e) => e.kind === kind) |
| 49 | .map((e) => cg!.getNode(e.target)) |
| 50 | .map((n) => `${n!.name}@${n!.filePath.replace(/\\/g, '/')}`); |
| 51 | } |
| 52 | |
| 53 | it('resolves an absolute dotted specifier to the module at a package root, not a same-named nested module', async () => { |
| 54 | write({ |
no test coverage detected