Skip to content

Commit

Permalink
fix npm badges when maintainers not in response (#10286)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s authored Jun 26, 2024
1 parent 5c81299 commit 61a6963
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion services/npm/npm-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const packageDataSchema = Joi.object({
maintainers: Joi.array()
// We don't need the keys here, just the length.
.items(Joi.object({}))
.required(),
.default([]),
types: Joi.string(),
// `typings` is an alias for `types` and often used
// https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package
Expand Down
9 changes: 9 additions & 0 deletions services/npm/npm-collaborators.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ t.create('contributor count for unknown package')
label: 'npm collaborators',
message: 'package not found',
})

t.create('contributor count for package package without a maintainers property')
.get('/package-without-maintainers.json')
.intercept(nock =>
nock('https://registry.npmjs.org')
.get('/package-without-maintainers/latest')
.reply(200, {}),
)
.expectBadge({ label: 'npm collaborators', message: '0' })

0 comments on commit 61a6963

Please sign in to comment.