Skip to content

Commit f28cca9

Browse files
fix: don't print the funding message for global installs (#9927)
Backport of #9864 to `release/v11`. Co-authored-by: Lazizbek Ergashev <[email protected]>
1 parent 7b8a6f1 commit f28cca9

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎lib/utils/reify-output.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const packagesChangedMessage = (npm, { added, removed, changed, audited }) => {
221221
}
222222

223223
const packagesFundingMessage = (npm, { funding }) => {
224-
if (!funding) {
224+
if (!funding || npm.global) {
225225
return
226226
}
227227

‎test/lib/utils/reify-output.js‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,35 @@ t.test('no message when funding config is false', async t => {
128128
t.notMatch(out, 'looking for funding', 'should not print funding info')
129129
})
130130

131+
t.test('no message when installing globally', async t => {
132+
const out = await mockReify(t, {
133+
actualTree: {
134+
name: 'foo',
135+
package: {
136+
name: 'foo',
137+
version: '1.0.0',
138+
},
139+
edgesOut: new Map([
140+
['bar', {
141+
to: {
142+
name: 'bar',
143+
package: {
144+
name: 'bar',
145+
version: '1.0.0',
146+
funding: { type: 'foo', url: 'http://example.com' },
147+
},
148+
},
149+
}],
150+
]),
151+
},
152+
diff: {
153+
children: [],
154+
},
155+
}, { global: true })
156+
157+
t.notMatch(out, 'looking for funding', 'should not print funding info')
158+
})
159+
131160
t.test('print appropriate message for many packages', async t => {
132161
const out = await mockReify(t, {
133162
actualTree: {

0 commit comments

Comments
 (0)