Skip to content

Commit

Permalink
fix(gitlabci): skip invalid currentVersion (#24698)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Sep 28, 2023
1 parent 6f52137 commit 30543c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/workers/repository/process/lookup/index.spec.ts
Expand Up @@ -80,6 +80,14 @@ describe('workers/repository/process/lookup/index', () => {
});

describe('.lookupUpdates()', () => {
it('returns null if invalid currentValue', async () => {
// @ts-expect-error: testing invalid currentValue
config.currentValue = 3;
expect((await lookup.lookupUpdates(config)).skipReason).toBe(
'invalid-value'
);
});

it('returns null if unknown datasource', async () => {
config.packageName = 'some-dep';
config.datasource = 'does not exist';
Expand Down
5 changes: 4 additions & 1 deletion lib/workers/repository/process/lookup/index.ts
Expand Up @@ -59,7 +59,10 @@ export async function lookupUpdates(
},
'lookupUpdates'
);
// istanbul ignore if
if (config.currentValue && !is.string(config.currentValue)) {
res.skipReason = 'invalid-value';
return res;
}
if (
!isGetPkgReleasesConfig(config) ||
!getDatasourceFor(config.datasource)
Expand Down

0 comments on commit 30543c9

Please sign in to comment.