mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 02:00:10 +00:00
b39b50f559
To provide more programmatic means to determine what environment variables configure Renovate configuration options - and whether they're Repo, Inherit or Global config options - we can expose these in two forms: - `getEnvOptionsMap()` - a static JSON file, `renovate-env-options.ts` This will provide programmatic use-cases from a plain JSON file that can be used more readily - especially as it's distributed in the docs and built package - as well as a function that can be used by users of Renovate-as-a-library. Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
67 lines
1.6 KiB
TypeScript
67 lines
1.6 KiB
TypeScript
import { getEnvOptionsMap } from './env-options.ts';
|
|
|
|
describe('config/options/env-options', () => {
|
|
const map = getEnvOptionsMap();
|
|
|
|
it('maps camelCase config names to RENOVATE_SCREAMING_SNAKE_CASE env vars', () => {
|
|
expect(map.RENOVATE_PLATFORM).toEqual(
|
|
expect.objectContaining({
|
|
configName: 'platform',
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('maps multi-word config names correctly', () => {
|
|
expect(map.RENOVATE_BASE_BRANCH_PATTERNS).toEqual(
|
|
expect.objectContaining({
|
|
configName: 'baseBranchPatterns',
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('marks globalOnly options correctly', () => {
|
|
expect(map.RENOVATE_DRY_RUN).toEqual(
|
|
expect.objectContaining({
|
|
configName: 'dryRun',
|
|
globalOnly: true,
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('marks non-globalOnly options correctly', () => {
|
|
expect(map.RENOVATE_ENABLED).toEqual(
|
|
expect.objectContaining({
|
|
configName: 'enabled',
|
|
globalOnly: false,
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('marks inheritConfigSupport options correctly', () => {
|
|
expect(map.RENOVATE_ONBOARDING_BRANCH).toEqual(
|
|
expect.objectContaining({
|
|
configName: 'onboardingBranch',
|
|
inheritConfigSupport: true,
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('excludes options with env: false', () => {
|
|
// bumpVersions has env: false
|
|
expect(map.RENOVATE_BUMP_VERSIONS).toBeUndefined();
|
|
});
|
|
|
|
it('includes the option type', () => {
|
|
expect(map.RENOVATE_DRY_RUN).toEqual(
|
|
expect.objectContaining({
|
|
type: 'string',
|
|
}),
|
|
);
|
|
expect(map.RENOVATE_ENABLED).toEqual(
|
|
expect.objectContaining({
|
|
type: 'boolean',
|
|
}),
|
|
);
|
|
});
|
|
});
|