Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(bumpVersions): correct broken test
This was failing due to invalid types.
  • Loading branch information
jamietanna committed Dec 2, 2025
commit aca015fdcbab454dee94eaa127a78abfbe346fbf
77 changes: 46 additions & 31 deletions lib/config/validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { GlobalConfig } from './global';
import type { RenovateConfig } from './types';
import * as configValidation from './validation';
import { partial } from '~test/util';

Check failure on line 5 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

'partial' is declared but its value is never read.

Check failure on line 5 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-eslint

'partial' is defined but never used. (@typescript-eslint/no-unused-vars)

describe('config/validation', () => {
describe('validateConfig(config)', () => {
Expand Down Expand Up @@ -2170,78 +2170,93 @@
expect(errors).toHaveLength(1);
});

it('errors if no bumpVersion filePattern is provided', async () => {
// @ts-expect-error -- TODO: fix test
const config = partial<RenovateConfig>({
bumpVersion: {
matchStrings: ['^(?<depName>foo)(?<currentValue>bar)$'],
bumpType: 'patch',
},
it('errors if no bumpVersions filePattern is provided', async () => {
const config: Partial<RenovateConfig> = {
// @ts-expect-error -- invalid config

Check failure on line 2175 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Unused '@ts-expect-error' directive.
bumpVersions: [
{

Check failure on line 2177 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Property 'filePatterns' is missing in type '{ matchStrings: string[]; bumpType: string; }' but required in type 'BumpVersionConfig'.
matchStrings: ['^(?<depName>foo)(?<currentValue>bar)$'],
bumpType: 'patch',
},
],
packageRules: [
{
matchPackageNames: ['foo'],
bumpVersion: {
matchStrings: ['^(?<depName>foo)(?<currentValue>bar)$'],
bumpType: 'patch',
},
// @ts-expect-error -- invalid config

Check failure on line 2185 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Unused '@ts-expect-error' directive.
bumpVersions: [
{

Check failure on line 2187 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Property 'filePatterns' is missing in type '{ matchStrings: string[]; bumpType: string; }' but required in type 'BumpVersionConfig'.
matchStrings: ['^(?<depName>foo)(?<currentValue>bar)$'],
bumpType: 'patch',
},
],
},
],
});
};
const { warnings, errors } = await configValidation.validateConfig(
'repo',
config,
true,
);
expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(2);

Check failure on line 2201 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / test (1/1)

lib/config/validation.spec.ts > config/validation > validate globalOptions() > errors if no bumpVersions filePattern is provided

AssertionError: expected [] to have a length of 2 but got +0 - Expected + Received - 2 + 0 ❯ lib/config/validation.spec.ts:2201:22
});

it('errors if no matchStrings are provided for bumpVersion', async () => {
// @ts-expect-error -- TODO: fix test
const config = partial<RenovateConfig>({
bumpVersion: {
filePatterns: ['foo'],
},
const config: RenovateConfig = {
// @ts-expect-error -- invalid config

Check failure on line 2206 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Unused '@ts-expect-error' directive.
bumpVersions: [
{

Check failure on line 2208 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Property 'matchStrings' is missing in type '{ filePatterns: string[]; }' but required in type 'BumpVersionConfig'.
filePatterns: ['foo'],
},
],
packageRules: [
{
matchPackageNames: ['foo'],
bumpVersion: {
filePatterns: ['bar'],
},
// @ts-expect-error -- invalid config

Check failure on line 2215 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Unused '@ts-expect-error' directive.
bumpVersions: [
{

Check failure on line 2217 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Property 'matchStrings' is missing in type '{ filePatterns: string[]; }' but required in type 'BumpVersionConfig'.
filePatterns: ['bar'],
},
],
},
],
});
};
const { warnings, errors } = await configValidation.validateConfig(
'repo',
config,
true,
);
expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(2);

Check failure on line 2230 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / test (1/1)

lib/config/validation.spec.ts > config/validation > validate globalOptions() > errors if no matchStrings are provided for bumpVersion

AssertionError: expected [] to have a length of 2 but got +0 - Expected + Received - 2 + 0 ❯ lib/config/validation.spec.ts:2230:22
});

it('allow bumpVersion', async () => {
// @ts-expect-error -- TODO: fix test
const config = partial<RenovateConfig>({
bumpVersion: {
filePatterns: ['foo'],
},
it('allow bumpVersions', async () => {
const config: RenovateConfig = {
// @ts-expect-error -- invalid config

Check failure on line 2235 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Unused '@ts-expect-error' directive.
bumpVersions: [
{
filePatterns: ['foo'],
},
],
packageRules: [
{
matchPackageNames: ['foo'],
bumpVersion: {
filePatterns: ['bar'],
},
// @ts-expect-error -- invalid config
bumpVersions: [
{
filePatterns: ['bar'],
},
],
},
],
});
};
const { warnings, errors } = await configValidation.validateConfig(
'repo',
config,
true,
);
expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(2);

Check failure on line 2259 in lib/config/validation.spec.ts

View workflow job for this annotation

GitHub Actions / test (1/1)

lib/config/validation.spec.ts > config/validation > validate globalOptions() > allow bumpVersions

AssertionError: expected [] to have a length of 2 but got +0 - Expected + Received - 2 + 0 ❯ lib/config/validation.spec.ts:2259:22
});
});
});
Loading