Files
renovate/lib/config/options/env-options.spec.ts
Jamie Tanna b39b50f559 chore: expose known environment variables (#42201)
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>
2026-04-14 15:27:50 +00:00

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',
}),
);
});
});