mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-02 10:33:39 +00:00
4add67e86e
* ci(linter): add prefer-partial-in-specs oxlint rule
Flags object literals cast to `any` (`{...} as any`) in spec/test files and steers toward `partial<T>()` from `test/util`. Enabled at error in the spec-files override so CI blocks new occurrences.
Closes #44646
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: drop unnecessary object-literal `as any` casts
The casts masked values already assignable to the expected type (migration configs accepted as Record<string, unknown>, all-optional param types, etc.); removing them restores real type checking.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: replace object-literal `as any` casts with partial<T>()
Uses partial<T>() from test/util so incomplete mock/config objects keep proper typing. Azure API mocks switch to mockResolvedValue(partial<T>()) and their inner method mocks to mockResolvedValue(), matching the sibling-file idiom.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: suppress prefer-partial-in-specs for intentionally-invalid inputs
Some tests deliberately pass malformed or legacy data to exercise validation/error paths, where no real type fits; keep the cast with a reasoned oxlint-disable-next-line.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
87 lines
1.8 KiB
TypeScript
87 lines
1.8 KiB
TypeScript
import { GlobalConfig } from '../../global.ts';
|
|
import { ExtendsMigration } from './extends-migration.ts';
|
|
|
|
describe('config/migrations/custom/extends-migration', () => {
|
|
it('migrates preset strings to array', async () => {
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: ':js-app',
|
|
},
|
|
{
|
|
extends: ['config:js-app'],
|
|
},
|
|
);
|
|
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: 'foo',
|
|
},
|
|
{
|
|
extends: ['foo'],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('migrates presets array', async () => {
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: ['foo', ':js-app', 'bar'],
|
|
},
|
|
{
|
|
extends: ['foo', 'config:js-app', 'bar'],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('should remove non string values', async () => {
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: [{}],
|
|
},
|
|
{
|
|
extends: [],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('should remove removed presets', async () => {
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: ['helpers:oddIsUnstable'],
|
|
},
|
|
{
|
|
extends: [],
|
|
},
|
|
);
|
|
});
|
|
|
|
it('migrates presets', async () => {
|
|
GlobalConfig.set({
|
|
migratePresets: {
|
|
'@org': 'local>org/renovate-config',
|
|
'@org2/foo': '',
|
|
},
|
|
});
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: ['@org', '@org2/foo'],
|
|
},
|
|
{
|
|
extends: ['local>org/renovate-config'],
|
|
},
|
|
);
|
|
GlobalConfig.reset();
|
|
});
|
|
|
|
it('migrate merge confidence config preset to internal preset', async () => {
|
|
await expect(ExtendsMigration).toMigrate(
|
|
{
|
|
extends: ['github>whitesource/merge-confidence:beta'],
|
|
},
|
|
{
|
|
extends: ['mergeConfidence:all-badges'],
|
|
},
|
|
);
|
|
});
|
|
});
|