diff --git a/services/npm/npm-base.js b/services/npm/npm-base.js index 523e3aaefe..0e461e8143 100644 --- a/services/npm/npm-base.js +++ b/services/npm/npm-base.js @@ -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 diff --git a/services/npm/npm-collaborators.tester.js b/services/npm/npm-collaborators.tester.js index 90488d5e85..c2f41b7e6b 100644 --- a/services/npm/npm-collaborators.tester.js +++ b/services/npm/npm-collaborators.tester.js @@ -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' })