(checkout: Path)
| 134 | statement: str, |
| 135 | ): |
| 136 | def build(checkout: Path) -> dict: |
| 137 | root = tmp_path / checkout |
| 138 | if target_path is not None: |
| 139 | _write(root / target_path, "export interface Value { id: string }\n") |
| 140 | barrel = _write(root / "index.ts", statement.format(specifier=specifier)) |
| 141 | |
| 142 | result = _extract_for([barrel], root) |
| 143 | projection = { |
| 144 | "nodes": result["nodes"], |
| 145 | "edges": result["edges"], |
| 146 | } |
| 147 | serialized = json.dumps(projection, sort_keys=True) |
| 148 | assert str(root) not in serialized |
| 149 | assert _make_id(str(root)) not in serialized |
| 150 | |
| 151 | expected_target = _unresolved_reexport_id(Path(specifier.removeprefix("./"))) |
| 152 | reexport_targets = { |
| 153 | edge["target"] |
| 154 | for edge in result["edges"] |
| 155 | if edge["relation"] == "re_exports" |
| 156 | } |
| 157 | assert expected_target in reexport_targets |
| 158 | return projection |
| 159 | |
| 160 | first = build(Path("checkout-a")) |
| 161 | second = build(Path("nested/checkout-b")) |
no test coverage detected