mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
fix(config-validator): allow default null
val for globalOptions
(#27616)
This commit is contained in:
parent
9f2394680e
commit
1efa2f21da
2 changed files with 174 additions and 119 deletions
|
@ -1251,6 +1251,39 @@ describe('config/validation', () => {
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('validates options with different type but defaultValue=null', async () => {
|
||||||
|
const config = {
|
||||||
|
minimumReleaseAge: null,
|
||||||
|
groupName: null,
|
||||||
|
groupSlug: null,
|
||||||
|
dependencyDashboardLabels: null,
|
||||||
|
defaultRegistryUrls: null,
|
||||||
|
registryUrls: null,
|
||||||
|
hostRules: [
|
||||||
|
{
|
||||||
|
artifactAuth: null,
|
||||||
|
concurrentRequestLimit: null,
|
||||||
|
httpsCertificate: null,
|
||||||
|
httpsPrivateKey: null,
|
||||||
|
httpsCertificateAuthority: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
encrypted: null,
|
||||||
|
milestone: null,
|
||||||
|
branchConcurrentLimit: null,
|
||||||
|
hashedBranchLength: null,
|
||||||
|
assigneesSampleSize: null,
|
||||||
|
reviewersSampleSize: null,
|
||||||
|
};
|
||||||
|
const { warnings, errors } = await configValidation.validateConfig(
|
||||||
|
false,
|
||||||
|
// @ts-expect-error: contains invalid values
|
||||||
|
config,
|
||||||
|
);
|
||||||
|
expect(warnings).toHaveLength(0);
|
||||||
|
expect(errors).toHaveLength(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('validate globalOptions()', () => {
|
describe('validate globalOptions()', () => {
|
||||||
|
@ -1540,5 +1573,25 @@ describe('config/validation', () => {
|
||||||
expect(warnings).toHaveLength(0);
|
expect(warnings).toHaveLength(0);
|
||||||
expect(errors).toHaveLength(0);
|
expect(errors).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('validates options with different type but defaultValue=null', async () => {
|
||||||
|
const config = {
|
||||||
|
onboardingCommitMessage: null,
|
||||||
|
dryRun: null,
|
||||||
|
logContext: null,
|
||||||
|
endpoint: null,
|
||||||
|
skipInstalls: null,
|
||||||
|
autodiscoverFilter: null,
|
||||||
|
autodiscoverNamespaces: null,
|
||||||
|
autodiscoverTopics: null,
|
||||||
|
};
|
||||||
|
const { warnings, errors } = await configValidation.validateConfig(
|
||||||
|
true,
|
||||||
|
// @ts-expect-error: contains invalid values
|
||||||
|
config,
|
||||||
|
);
|
||||||
|
expect(warnings).toHaveLength(0);
|
||||||
|
expect(errors).toHaveLength(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -828,6 +828,7 @@ async function validateGlobalConfig(
|
||||||
warnings: ValidationMessage[],
|
warnings: ValidationMessage[],
|
||||||
currentPath: string | undefined,
|
currentPath: string | undefined,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
if (val !== null) {
|
||||||
if (type === 'string') {
|
if (type === 'string') {
|
||||||
if (is.string(val)) {
|
if (is.string(val)) {
|
||||||
if (
|
if (
|
||||||
|
@ -963,6 +964,7 @@ async function validateGlobalConfig(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An option is a false global if it has the same name as a global only option
|
/** An option is a false global if it has the same name as a global only option
|
||||||
|
|
Loading…
Reference in a new issue