mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: raise config errors for package rules missing selectors
This commit is contained in:
parent
1c96ba54b4
commit
906c6273c7
3 changed files with 11 additions and 17 deletions
|
@ -141,12 +141,12 @@ async function validateConfig(config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasSelector) {
|
if (!hasSelector) {
|
||||||
const message =
|
const message = `Each packageRule must contain at least one selector (${selectors.join(
|
||||||
'Each packageRule must contain at least one of ' +
|
', '
|
||||||
JSON.stringify(selectors);
|
)}). 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`);
|
logger.info({ packageRule }, `packageRule warning`);
|
||||||
warnings.push({
|
errors.push({
|
||||||
depName: 'Configuration Warning',
|
depName: 'Configuration Error',
|
||||||
message,
|
message,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`config/validation validateConfig(config) errors for all types 1`] = `
|
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 [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"depName": "Configuration Error",
|
"depName": "Configuration Error",
|
||||||
|
@ -47,6 +38,10 @@ Array [
|
||||||
"depName": "Configuration Error",
|
"depName": "Configuration Error",
|
||||||
"message": "Invalid configuration option: \`foo\`",
|
"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 {
|
Object {
|
||||||
"depName": "Configuration Error",
|
"depName": "Configuration Error",
|
||||||
"message": "packageRules must contain JSON objects",
|
"message": "packageRules must contain JSON objects",
|
||||||
|
|
|
@ -43,10 +43,9 @@ describe('config/validation', () => {
|
||||||
const { warnings, errors } = await configValidation.validateConfig(
|
const { warnings, errors } = await configValidation.validateConfig(
|
||||||
config
|
config
|
||||||
);
|
);
|
||||||
expect(warnings).toMatchSnapshot();
|
expect(warnings).toHaveLength(0);
|
||||||
expect(warnings).toHaveLength(1);
|
|
||||||
expect(errors).toMatchSnapshot();
|
expect(errors).toMatchSnapshot();
|
||||||
expect(errors).toHaveLength(10);
|
expect(errors).toHaveLength(11);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue