* Traverses the Angular internal tree from the root to discover element and environment injectors.
(roots: HTMLElement[])
| 68 | * Traverses the Angular internal tree from the root to discover element and environment injectors. |
| 69 | */ |
| 70 | function discoverDiGraph(roots: HTMLElement[]): DiGraph { |
| 71 | const rootLViews = roots.map((root) => { |
| 72 | const lContext = getLContext(root); |
| 73 | if (!lContext?.lView) { |
| 74 | throw new Error( |
| 75 | `Could not find an \`LView\` for root \`<${root.tagName.toLowerCase()}>\`, is it an Angular component?`, |
| 76 | ); |
| 77 | } |
| 78 | return lContext.lView; |
| 79 | }); |
| 80 | |
| 81 | return { |
| 82 | elementInjectorRoots: rootLViews.map((rootLView) => walkElementInjectors(rootLView)), |
| 83 | environmentInjectorRoot: collectEnvInjectors(rootLViews), |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Traverses all directive-hosting nodes in the `rootLView` hierarchy and builds a tree of |
no test coverage detected