Skip to content
Merged
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/utils/reify-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const reifyOutput = (npm, arb, extras = {}) => {
if (showDiff) {
output.standard(`${chalk.green('add')} ${d.ideal.name} ${d.ideal.package.version}`)
}
if (actualTree.inventory.has(d.ideal)) {
// Linked store packages live under .store, absent from the logical actualTree, so identity lookup misses them; count each store package node (non-link).
if (actualTree.inventory.has(d.ideal) || (d.ideal.isInStore && !d.ideal.isLink)) {
summary.added++
summary.add.push({
name: d.ideal.name,
Expand Down
5 changes: 5 additions & 0 deletions tap-snapshots/test/lib/utils/reify-output.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ exports[`test/lib/utils/reify-output.js TAP added packages should be looked up w
added 1 package in {TIME}
`

exports[`test/lib/utils/reify-output.js TAP added packages should be looked up within returned tree linked store package counted though absent from actualTree > must match snapshot 1`] = `
added 1 package in {TIME}
`

exports[`test/lib/utils/reify-output.js TAP added packages should be looked up within returned tree missing added pkg in inventory > must match snapshot 1`] = `
up to date in {TIME}
Expand Down
19 changes: 19 additions & 0 deletions test/lib/utils/reify-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,25 @@ t.test('added packages should be looked up within returned tree', async t => {

t.matchSnapshot(out)
})

t.test('linked store package counted though absent from actualTree', async t => {
const out = await mockReify(t, {
actualTree: {
name: 'foo',
inventory: {
has: () => false,
},
},
diff: {
children: [
{ action: 'ADD', ideal: { path: 'test/baz', name: 'baz', isInStore: true, isLink: false, package: { version: '1.0.0' } } },
{ action: 'ADD', ideal: { path: 'test/baz-link', name: 'baz', isInStore: false, isLink: true, package: { version: '1.0.0' } } },
],
},
})

t.matchSnapshot(out)
})
})

t.test('prints dedupe difference on dry-run', async t => {
Expand Down
Loading