Skip to content

Commit d092edf

Browse files
committed
fix coverage
1 parent 17f8410 commit d092edf

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/commands/ls.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ class LS extends ArboristWorkspaceCmd {
131131
const target = (node.target)?.edgesOut
132132

133133
const shouldSkipChildren =
134-
(currentDepth > depthToPrint) ||
135-
(!nodeResult && !node.isRoot) || nodeResult?.isCircular
134+
(currentDepth > depthToPrint)
135+
|| nodeResult?.isCircular
136136

137-
return (shouldSkipChildren)
137+
return (shouldSkipChildren || !target)
138138
? []
139-
: [...(target?.values() || [])]
139+
: [...target.values()]
140140
.filter(filterBySelectedWorkspaces)
141141
.filter(currentDepth === 0 ? filterByEdgesTypes({
142142
link,
@@ -170,9 +170,7 @@ class LS extends ArboristWorkspaceCmd {
170170
}
171171
}
172172

173-
if (item) {
174-
item.traversePath = (node[_parent]?.traversePath || []).concat([node.realpath + '-' + node.pkgid])
175-
}
173+
item.traversePath = (node[_parent]?.traversePath || []).concat([node.realpath + '-' + node.pkgid])
176174

177175
if (node[_parent]?.traversePath?.includes(node.realpath + '-' + node.pkgid)) {
178176
item.isCircular = true
@@ -429,7 +427,7 @@ const filterByEdgesTypes = ({ link, omit }) => (edge) => {
429427
const appendExtraneousChildren = ({ node, seenPaths }) =>
430428
// extraneous children are not represented
431429
// in edges out, so here we add them to the list:
432-
[...((node?.children)?.values() || [])]
430+
[...node.children.values()]
433431
.filter(i => !seenPaths.has(i.path) && i.extraneous)
434432

435433
const mapEdgesToNodes = ({ seenPaths }) => (edge) => {

0 commit comments

Comments
 (0)