Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): migrate requiredStatusChecks to ignoreTests
- Loading branch information
1 parent
d747f3e
commit 395bd46
Showing
33 changed files
with
168 additions
and
245 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
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,18 @@ | ||
import type { RenovateConfig } from '../types'; | ||
|
||
export abstract class Migration { | ||
protected readonly originalConfig: RenovateConfig; | ||
|
||
protected readonly migratedConfig: RenovateConfig; | ||
|
||
constructor(originalConfig: RenovateConfig, migratedConfig: RenovateConfig) { | ||
this.originalConfig = originalConfig; | ||
this.migratedConfig = migratedConfig; | ||
} | ||
|
||
abstract migrate(): RenovateConfig; | ||
|
||
protected delete(property: string): void { | ||
delete this.migratedConfig[property]; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
lib/config/migrations/required-status-checks-migration.spec.ts
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,21 @@ | ||
import { RequiredStatusChecksMigration } from './required-status-checks-migration'; | ||
|
||
describe('config/migrations/required-status-checks-migration', () => { | ||
it('should migrate requiredStatusChecks=null to ignoreTests=true', () => { | ||
const originalConfig: any = { | ||
requiredStatusChecks: null, | ||
}; | ||
const migratedConfig: any = { | ||
requiredStatusChecks: null, | ||
}; | ||
const migration = new RequiredStatusChecksMigration( | ||
originalConfig, | ||
migratedConfig | ||
); | ||
|
||
expect(migratedConfig.requiredStatusChecks).toBeNull(); | ||
migration.migrate(); | ||
expect(migratedConfig.requiredStatusChecks).toBeUndefined(); | ||
expect(migratedConfig.ignoreTests).toBeTrue(); | ||
}); | ||
}); |
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,14 @@ | ||
import { RenovateConfig } from '../types'; | ||
import { Migration } from './migration'; | ||
|
||
export class RequiredStatusChecksMigration extends Migration { | ||
public migrate(): RenovateConfig { | ||
this.delete('requiredStatusChecks'); | ||
|
||
if (this.originalConfig.requiredStatusChecks === null) { | ||
this.migratedConfig.ignoreTests = true; | ||
} | ||
|
||
return this.migratedConfig; | ||
} | ||
} |
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
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
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
Oops, something went wrong.