Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class LS extends ArboristWorkspaceCmd {
...this.npm.flatOptions,
legacyPeerDeps: false,
path,
forceActual: long && !json && !parseable && !packageLockOnly,
})
const tree = await this.initTree({ arb, args, packageLockOnly })

Expand Down Expand Up @@ -339,7 +340,7 @@ const getHumanOutputItem = (node, { args, chalk, global, long }) => {
) +
(isGitNode(node) ? ` (${node.resolved})` : '') +
(node.isLink ? ` -> ${relativePrefix}${targetLocation}` : '') +
(long ? `\n${node.package.description || ''}` : '')
(long && !node[_missing] ? `\n${node.package.description || ''}` : '')

return augmentItemWithIncludeMetadata(node, { label, nodes: [] })
}
Expand Down
26 changes: 26 additions & 0 deletions tap-snapshots/test/lib/commands/ls.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ Array [
]
`

exports[`test/lib/commands/ls.js TAP ignore missing optional deps --long human output > ls --long result 1`] = `
[email protected]
| {CWD}/prefix
|
+-- UNMET OPTIONAL DEPENDENCY optional-missing@1
+-- [email protected]
|
+-- [email protected] invalid: "1" from the root project
|
+-- UNMET DEPENDENCY peer-missing@1
+-- [email protected]
|
+-- UNMET OPTIONAL DEPENDENCY peer-optional-missing@1
+-- [email protected] extraneous
|
+-- [email protected] invalid: "1" from the root project extraneous
|
+-- [email protected] invalid: "1" from the root project
|
+-- UNMET DEPENDENCY prod-missing@1
+-- [email protected]
|
\`-- [email protected] invalid: "1" from the root project

`

exports[`test/lib/commands/ls.js TAP ignore missing optional deps --parseable > ls --parseable result 1`] = `
{CWD}/prefix
{CWD}/prefix/node_modules/optional-ok
Expand Down
5 changes: 5 additions & 0 deletions test/lib/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,11 @@ t.test('ignore missing optional deps', async t => {
const result = await mock(t)
t.matchSnapshot(result, 'ls result')
})

t.test('--long human output', async t => {
const result = await mock(t, { long: true })
t.matchSnapshot(result, 'ls --long result')
})
})

t.test('ls --json', async t => {
Expand Down