From 1d710cb8b1aa3a58ffcba825e43432d8f3bbe198 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 21 Oct 2020 13:58:00 -0700 Subject: [PATCH] do not elide edges in explain() output when a root edge exists --- lib/node.js | 10 ++-------- test/node.js | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/node.js b/lib/node.js index 3d1771af6..bb58b244c 100644 --- a/lib/node.js +++ b/lib/node.js @@ -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) diff --git a/test/node.js b/test/node.js index 557dafde1..02422f6b3 100644 --- a/test/node.js +++ b/test/node.js @@ -1617,6 +1617,5 @@ t.test('explain yourself', t => { package: { noname: 'bad', noversion: 'node' }, }) - t.end() })