diff --git a/lib/config/validation.js b/lib/config/validation.js index e92c4494e1..569017fd50 100644 --- a/lib/config/validation.js +++ b/lib/config/validation.js @@ -141,12 +141,12 @@ async function validateConfig(config) { } } if (!hasSelector) { - const message = - 'Each packageRule must contain at least one of ' + - JSON.stringify(selectors); + const message = `Each packageRule must contain at least one selector (${selectors.join( + ', ' + )}). If you wish for configuration to apply to all packages, it is not necessary to place it inside a packageRule at all.`; logger.info({ packageRule }, `packageRule warning`); - warnings.push({ - depName: 'Configuration Warning', + errors.push({ + depName: 'Configuration Error', message, }); } diff --git a/test/config/__snapshots__/validation.spec.js.snap b/test/config/__snapshots__/validation.spec.js.snap index 850a6a6af2..1822f6a43d 100644 --- a/test/config/__snapshots__/validation.spec.js.snap +++ b/test/config/__snapshots__/validation.spec.js.snap @@ -1,15 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`config/validation validateConfig(config) errors for all types 1`] = ` -Array [ - Object { - "depName": "Configuration Warning", - "message": "Each packageRule must contain at least one of [\\"packageNames\\",\\"packagePatterns\\",\\"excludePackageNames\\",\\"excludePackagePatterns\\"]", - }, -] -`; - -exports[`config/validation validateConfig(config) errors for all types 2`] = ` Array [ Object { "depName": "Configuration Error", @@ -47,6 +38,10 @@ Array [ "depName": "Configuration Error", "message": "Invalid configuration option: \`foo\`", }, + Object { + "depName": "Configuration Error", + "message": "Each packageRule must contain at least one selector (packageNames, packagePatterns, excludePackageNames, excludePackagePatterns). If you wish for configuration to apply to all packages, it is not necessary to place it inside a packageRule at all.", + }, Object { "depName": "Configuration Error", "message": "packageRules must contain JSON objects", diff --git a/test/config/validation.spec.js b/test/config/validation.spec.js index e8a88b8083..7089be9fd8 100644 --- a/test/config/validation.spec.js +++ b/test/config/validation.spec.js @@ -43,10 +43,9 @@ describe('config/validation', () => { const { warnings, errors } = await configValidation.validateConfig( config ); - expect(warnings).toMatchSnapshot(); - expect(warnings).toHaveLength(1); + expect(warnings).toHaveLength(0); expect(errors).toMatchSnapshot(); - expect(errors).toHaveLength(10); + expect(errors).toHaveLength(11); }); }); });