-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): add repo phase enviorment config (#33360)
- Loading branch information
1 parent
80faed3
commit 19a99d2
Showing
4 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { AllConfig } from '../../../config/types'; | ||
import { mergeStaticRepoEnvConfig } from './config'; | ||
|
||
describe('workers/repository/init/config', () => { | ||
describe('mergeRepoEnvConfig()', () => { | ||
type MergeRepoEnvTestCase = { | ||
name: string; | ||
env: NodeJS.ProcessEnv; | ||
currentConfig: AllConfig; | ||
wantConfig: AllConfig; | ||
}; | ||
|
||
const testCases: MergeRepoEnvTestCase[] = [ | ||
{ | ||
name: 'it does nothing', | ||
env: {}, | ||
currentConfig: { repositories: ['some/repo'] }, | ||
wantConfig: { repositories: ['some/repo'] }, | ||
}, | ||
{ | ||
name: 'it merges env with the current config', | ||
env: { RENOVATE_STATIC_REPO_CONFIG: '{"dependencyDashboard":true}' }, | ||
currentConfig: { repositories: ['some/repo'] }, | ||
wantConfig: { | ||
dependencyDashboard: true, | ||
repositories: ['some/repo'], | ||
}, | ||
}, | ||
{ | ||
name: 'it ignores env with other renovate specific configuration options', | ||
env: { RENOVATE_CONFIG: '{"dependencyDashboard":true}' }, | ||
currentConfig: { repositories: ['some/repo'] }, | ||
wantConfig: { repositories: ['some/repo'] }, | ||
}, | ||
]; | ||
|
||
it.each(testCases)( | ||
'$name', | ||
async ({ env, currentConfig, wantConfig }: MergeRepoEnvTestCase) => { | ||
const got = await mergeStaticRepoEnvConfig(currentConfig, env); | ||
|
||
expect(got).toEqual(wantConfig); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters