(ancestors, projectName)
| 620 | } |
| 621 | |
| 622 | _checkCycle(ancestors, projectName) { |
| 623 | if (ancestors.includes(projectName)) { |
| 624 | // "Back-edge" detected. Neither BFS nor DFS searches should continue |
| 625 | // Mark first and last occurrence in chain with an asterisk and throw an error detailing the |
| 626 | // problematic dependency chain |
| 627 | ancestors[ancestors.indexOf(projectName)] = `*${projectName}*`; |
| 628 | throw new Error(`Detected cyclic dependency chain: ${ancestors.join(" -> ")} -> *${projectName}*`); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | // TODO: introduce function to check for dangling nodes/consistency in general? |
| 633 | } |
no test coverage detected