Skip to content

Commit 1f82ba9

Browse files
committed
fix: unmet label on deduped deps
1 parent 5877296 commit 1f82ba9

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

lib/ls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ const augmentNodesWithMetadata = ({
263263
pkgid: node.pkgid,
264264
package: node.package,
265265
path: node.path,
266+
[_missing]: node[_missing],
266267
[_dedupe]: true
267268
}
268269
} else {

tap-snapshots/test-lib-ls.js-TAP.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,14 @@ [email protected] {CWD}/ls-ls-cycle-deps
336336
337337
`
338338

339+
exports[`test/lib/ls.js TAP ls deduped missing dep > should output parseable signaling missing peer dep in problems 1`] = `
340+
[email protected] {CWD}/ls-ls-deduped-missing-dep
341+
342+
| \`-- UNMET DEPENDENCY b@^1.0.0 deduped
343+
\`-- UNMET DEPENDENCY b@^1.0.0
344+
345+
`
346+
339347
exports[`test/lib/ls.js TAP ls default --depth value should be 0 > should output tree containing only top-level dependencies 1`] = `
340348
[email protected] {CWD}/ls-ls-default-depth-value-should-be-0
341349

test/lib/ls.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,36 @@ test('ls', (t) => {
719719
})
720720
})
721721

722+
t.test('deduped missing dep', (t) => {
723+
prefix = t.testdir({
724+
'package.json': JSON.stringify({
725+
name: 'test-npm-ls',
726+
version: '1.0.0',
727+
dependencies: {
728+
'a': '^1.0.0',
729+
'b': '^1.0.0'
730+
}
731+
}),
732+
node_modules: {
733+
a: {
734+
'package.json': JSON.stringify({
735+
name: 'a',
736+
version: '1.0.0',
737+
dependencies: {
738+
b: '^1.0.0'
739+
}
740+
})
741+
}
742+
}
743+
})
744+
ls([], (err) => {
745+
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
746+
t.match(err.message, /missing: b@\^1.0.0/, 'should list missing dep problem')
747+
t.matchSnapshot(redactCwd(result), 'should output parseable signaling missing peer dep in problems')
748+
t.end()
749+
})
750+
})
751+
722752
t.test('unmet peer dep', (t) => {
723753
prefix = t.testdir({
724754
'package.json': JSON.stringify({

0 commit comments

Comments
 (0)