diff --git a/lib/workers/repository/process/fetch.spec.ts b/lib/workers/repository/process/fetch.spec.ts index 6590a074a9520230beb13df9e7a6b1ee3e2dba78..9448ff3944cc300f66fccb01f20cdb768bde6222 100644 --- a/lib/workers/repository/process/fetch.spec.ts +++ b/lib/workers/repository/process/fetch.spec.ts @@ -77,17 +77,19 @@ describe('workers/repository/process/fetch', () => { { depName: ' ' }, { depName: null }, { depName: undefined }, + { depName: { oh: 'no' } as unknown as string }, ], }, ], }; await fetchUpdates(config, packageFiles); - expect(packageFiles.docker[0].deps[0].skipReason).toBe('missing-depname'); + expect(packageFiles.docker[0].deps[0].skipReason).toBe('invalid-name'); expect(packageFiles.docker[0].deps[1].skipReason).toBeUndefined(); - expect(packageFiles.docker[0].deps[2].skipReason).toBe('missing-depname'); - expect(packageFiles.docker[0].deps[3].skipReason).toBe('missing-depname'); - expect(packageFiles.docker[0].deps[4].skipReason).toBe('missing-depname'); - expect(packageFiles.docker[0].deps[5].skipReason).toBe('missing-depname'); + expect(packageFiles.docker[0].deps[2].skipReason).toBe('invalid-name'); + expect(packageFiles.docker[0].deps[3].skipReason).toBe('invalid-name'); + expect(packageFiles.docker[0].deps[4].skipReason).toBe('invalid-name'); + expect(packageFiles.docker[0].deps[5].skipReason).toBe('invalid-name'); + expect(packageFiles.docker[0].deps[6].skipReason).toBe('invalid-name'); }); }); }); diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 75bbcd6a3a8f99e15a02293b425a312488c1de0c..3ea114fd10a3c6e70a86683631c18fbc7297b999 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -16,8 +16,11 @@ async function fetchDepUpdates( ): Promise<PackageDependency> { let dep = clone(indep); dep.updates = []; - if (!is.nonEmptyString(dep.depName?.trim())) { - dep.skipReason = 'missing-depname'; + if (is.string(dep.depName)) { + dep.depName = dep.depName.trim(); + } + if (!is.nonEmptyString(dep.depName)) { + dep.skipReason = 'invalid-name'; } if (dep.skipReason) { return dep;