Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
do not elide edges in explain() output when a root edge exists
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Oct 21, 2020
1 parent 1742524 commit 1d710cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
10 changes: 2 additions & 8 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,19 +369,13 @@ class Node {
if (edge)
why.dependents.push(edge.explain(seen))
else {
// if we have an edge from the root, just show that, and stop there
// no need to go deeper, because it doesn't provide much more value.
// ignore invalid edges, since those aren't satisfied by this thing,
// and are not keeping it held in this spot anyway.
const edges = []
for (const edge of this.edgesIn) {
if (!edge.valid && !edge.from.isRoot)
continue

if (edge.from.isRoot) {
edges.length = 0
edges.push(edge)
break
}

edges.push(edge)
}
for (const edge of edges)
Expand Down
1 change: 0 additions & 1 deletion test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,5 @@ t.test('explain yourself', t => {
package: { noname: 'bad', noversion: 'node' },
})


t.end()
})

0 comments on commit 1d710cb

Please sign in to comment.