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
5 changes: 3 additions & 2 deletions lib/commands/bugs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class Bugs extends PackageUrlCmd {

// try to get it from the repo, if possible
const info = this.hostedFromMani(mani)
if (info) {
return info.bugs()
const infoUrl = info?.bugs()
if (infoUrl) {
return infoUrl
}

// just send them to the website, hopefully that has some info!
Expand Down
5 changes: 5 additions & 0 deletions test/lib/commands/bugs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const pacote = {
return spec === 'nobugs' ? {
name: 'nobugs',
version: '1.2.3',
} : spec === 'nullbugs' ? {
name: 'nullbugs',
version: '1.2.3',
bugs: null,
} : spec === 'bugsurl' ? {
name: 'bugsurl',
version: '1.2.3',
Expand Down Expand Up @@ -66,6 +70,7 @@ t.test('open bugs urls & emails', async t => {
const expected = {
'.': 'https://example.com',
nobugs: 'https://www.npmjs.com/package/nobugs',
nullbugs: 'https://www.npmjs.com/package/nullbugs',
'bugsobj-nourl': 'https://www.npmjs.com/package/bugsobj-nourl',
bugsurl: 'https://bugzilla.localhost/bugsurl',
bugsobj: 'https://bugzilla.localhost/bugsobj',
Expand Down