From 2b636273bd8a7a1dbb3c06344119a9bf1c93b706 Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Wed, 29 Jul 2020 13:11:30 +0200 Subject: [PATCH] refactor: small refactoring (#6876) --- .../__snapshots__/github.spec.ts.snap | 12 ++-- .../__snapshots__/gitlab.spec.ts.snap | 16 ++--- .../__snapshots__/index.spec.ts.snap | 24 +++---- .../__snapshots__/release-notes.spec.ts.snap | 72 +++++++++---------- lib/workers/pr/changelog/common.ts | 5 ++ lib/workers/pr/changelog/github.spec.ts | 3 +- lib/workers/pr/changelog/gitlab.spec.ts | 3 +- lib/workers/pr/changelog/index.spec.ts | 4 +- .../pr/changelog/release-notes.spec.ts | 3 +- lib/workers/pr/changelog/release-notes.ts | 6 +- lib/workers/pr/changelog/releases.spec.ts | 4 +- 11 files changed, 80 insertions(+), 72 deletions(-) diff --git a/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap index 28909eddbc..10deb94889 100644 --- a/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog getChangeLogJSON filters unnecessary warns 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON filters unnecessary warns 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -51,7 +51,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -102,7 +102,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -153,7 +153,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports node engines 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON supports node engines 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -204,7 +204,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitHub tags 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON uses GitHub tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -255,7 +255,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON works without Github 1`] = ` +exports[`workers/pr/changelog/github getChangeLogJSON works without Github 1`] = ` Object { "hasReleaseNotes": true, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap index 5f394fc746..fe891bae24 100644 --- a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog getChangeLogJSON handles empty GitLab tags response 1`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -43,7 +43,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON handles empty GitLab tags response 2`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 2`] = ` Array [ Object { "headers": Object { @@ -147,7 +147,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON supports gitlab enterprise and gitlab enterprise changelog 1`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON supports gitlab enterprise and gitlab enterprise changelog 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -190,7 +190,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitLab tags 1`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -249,7 +249,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitLab tags 2`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 2`] = ` Array [ Object { "headers": Object { @@ -353,7 +353,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON uses GitLab tags with error 1`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -396,7 +396,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitLab tags with error 2`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 2`] = ` Array [ Object { "headers": Object { @@ -500,7 +500,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON works without GitLab 1`] = ` +exports[`workers/pr/changelog/gitlab getChangeLogJSON works without GitLab 1`] = ` Object { "hasReleaseNotes": false, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap index fa7ea9e4cf..1907c06688 100644 --- a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog getChangeLogJSON filters unnecessary warns 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON filters unnecessary warns 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -51,7 +51,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON filters unnecessary warns 2`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON filters unnecessary warns 2`] = ` Array [ Object { "headers": Object { @@ -155,7 +155,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -206,7 +206,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github enterprise changelog 2`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 2`] = ` Array [ Object { "headers": Object { @@ -310,7 +310,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -361,7 +361,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports github enterprise and github.com changelog 2`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 2`] = ` Array [ Object { "headers": Object { @@ -465,7 +465,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON supports github.com and github enterprise changelog 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -516,7 +516,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON supports github.com and github enterprise changelog 2`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 2`] = ` Array [ Object { "headers": Object { @@ -620,7 +620,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON supports node engines 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON supports node engines 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -671,7 +671,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitHub tags 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON uses GitHub tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -726,7 +726,7 @@ Object { } `; -exports[`workers/pr/changelog getChangeLogJSON uses GitHub tags 2`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON uses GitHub tags 2`] = ` Array [ Object { "headers": Object { @@ -830,7 +830,7 @@ Array [ ] `; -exports[`workers/pr/changelog getChangeLogJSON works without Github 1`] = ` +exports[`workers/pr/changelog/index getChangeLogJSON works without Github 1`] = ` Object { "hasReleaseNotes": true, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap b/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap index b1d3afabd8..5d3ba16627 100644 --- a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap +++ b/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/release-notes addReleaseNotes() returns ChangeLogResult 1`] = ` +exports[`workers/pr/changelog/release-notes addReleaseNotes() returns ChangeLogResult 1`] = ` Object { "a": 1, "hasReleaseNotes": false, @@ -19,7 +19,7 @@ Object { } `; -exports[`workers/pr/release-notes addReleaseNotes() returns ChangeLogResult without release notes 1`] = ` +exports[`workers/pr/changelog/release-notes addReleaseNotes() returns ChangeLogResult without release notes 1`] = ` Object { "a": 1, "hasReleaseNotes": false, @@ -38,7 +38,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseList() should return release list for github repo 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for github repo 1`] = ` Array [ Object { "body": undefined, @@ -57,7 +57,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseList() should return release list for github repo 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for github repo 2`] = ` Array [ Object { "headers": Object { @@ -72,7 +72,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseList() should return release list for gitlab.com project 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 1`] = ` Array [ Object { "body": undefined, @@ -89,7 +89,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseList() should return release list for gitlab.com project 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 2`] = ` Array [ Object { "headers": Object { @@ -104,7 +104,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 1`] = ` Object { "body": "some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124) ", @@ -115,7 +115,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 2`] = ` Array [ Object { "headers": Object { @@ -130,7 +130,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 3`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 3`] = ` Object { "body": "some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124) ", @@ -141,7 +141,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 4`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 4`] = ` Array [ Object { "headers": Object { @@ -156,7 +156,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 5`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 5`] = ` Object { "body": "some body [#123](https://github.com/some/other-repository/issues/123), [#124](https://github.com/some/yet-other-repository/issues/124) ", @@ -167,7 +167,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body 6`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body 6`] = ` Array [ Object { "headers": Object { @@ -182,9 +182,9 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo 1`] = `null`; +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo 1`] = `null`; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo 2`] = ` Array [ Object { "headers": Object { @@ -199,9 +199,9 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo other- 1`] = `null`; +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo other- 1`] = `null`; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo other- 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo other- 2`] = ` Array [ Object { "headers": Object { @@ -216,9 +216,9 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo v 1`] = `null`; +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo v 1`] = `null`; -exports[`workers/pr/release-notes getReleaseNotes() gets release notes with body from gitlab repo v 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo v 2`] = ` Array [ Object { "headers": Object { @@ -233,7 +233,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotes() should return null for release notes without body 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotes() should return null for release notes without body 1`] = ` Array [ Object { "headers": Object { @@ -248,7 +248,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 1`] = ` Object { "body": "- add new auth, fix accept header and base path in mock @@ -262,7 +262,7 @@ See merge request itentialopensource/adapter-utils!177 } `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` Array [ Object { "headers": Object { @@ -287,7 +287,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` Object { "body": "##### âš BREAKING CHANGES @@ -317,7 +317,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` Array [ Object { "headers": Object { @@ -342,7 +342,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` Object { "body": "##### Features @@ -357,7 +357,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` Array [ Object { "headers": Object { @@ -382,7 +382,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` Array [ Object { "headers": Object { @@ -407,7 +407,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` Array [ Object { "headers": Object { @@ -422,7 +422,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() handles wrong format 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles wrong format 1`] = ` Array [ Object { "headers": Object { @@ -447,7 +447,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses angular.js 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 1`] = ` Object { "body": "#### Bug Fixes @@ -477,7 +477,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses angular.js 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 2`] = ` Array [ Object { "headers": Object { @@ -502,7 +502,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 1`] = ` Object { "body": "- Removing markup from a part of the French translation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1878> - Fix typo documentation -> documentation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1880> @@ -518,7 +518,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` Array [ Object { "headers": Object { @@ -543,7 +543,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses jest 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 1`] = ` Object { "body": "##### Fixes @@ -735,7 +735,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses jest 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 2`] = ` Array [ Object { "headers": Object { @@ -760,7 +760,7 @@ Array [ ] `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` Object { "body": "- Fix \`condenseFlow\` output (quote keys for sure, instead of spaces), [#371](https://github.com/nodeca/js-yaml/issues/371), [#370](https://github.com/nodeca/js-yaml/issues/370). - Dump astrals as codepoints instead of surrogate pair, [#368](https://github.com/nodeca/js-yaml/issues/368). @@ -769,7 +769,7 @@ Object { } `; -exports[`workers/pr/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` +exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` Array [ Object { "headers": Object { diff --git a/lib/workers/pr/changelog/common.ts b/lib/workers/pr/changelog/common.ts index 36d83387ae..3ae81316b6 100644 --- a/lib/workers/pr/changelog/common.ts +++ b/lib/workers/pr/changelog/common.ts @@ -40,3 +40,8 @@ export interface ChangeLogResult { versions?: ChangeLogRelease[]; error?: ChangeLogError; } + +export interface ChangeLogFile { + changelogFile: string; + changelogMd: string; +} diff --git a/lib/workers/pr/changelog/github.spec.ts b/lib/workers/pr/changelog/github.spec.ts index 9d0d057696..aa56293842 100644 --- a/lib/workers/pr/changelog/github.spec.ts +++ b/lib/workers/pr/changelog/github.spec.ts @@ -1,3 +1,4 @@ +import { getName } from '../../../../test/util'; import { PLATFORM_TYPE_GITHUB } from '../../../constants/platforms'; import * as hostRules from '../../../util/host-rules'; import * as semverVersioning from '../../../versioning/semver'; @@ -28,7 +29,7 @@ const upgrade: BranchUpgradeConfig = { ], }; -describe('workers/pr/changelog', () => { +describe(getName(__filename), () => { describe('getChangeLogJSON', () => { beforeEach(() => { hostRules.clear(); diff --git a/lib/workers/pr/changelog/gitlab.spec.ts b/lib/workers/pr/changelog/gitlab.spec.ts index f069c020a5..04e711c215 100644 --- a/lib/workers/pr/changelog/gitlab.spec.ts +++ b/lib/workers/pr/changelog/gitlab.spec.ts @@ -1,4 +1,5 @@ import * as httpMock from '../../../../test/httpMock'; +import { getName } from '../../../../test/util'; import { PLATFORM_TYPE_GITLAB } from '../../../constants/platforms'; import * as hostRules from '../../../util/host-rules'; import * as semverVersioning from '../../../versioning/semver'; @@ -30,7 +31,7 @@ const upgrade: BranchUpgradeConfig = { const baseUrl = 'https://gitlab.com/'; -describe('workers/pr/changelog', () => { +describe(getName(__filename), () => { describe('getChangeLogJSON', () => { beforeEach(() => { httpMock.setup(); diff --git a/lib/workers/pr/changelog/index.spec.ts b/lib/workers/pr/changelog/index.spec.ts index 9256159a83..d7d9071fe6 100644 --- a/lib/workers/pr/changelog/index.spec.ts +++ b/lib/workers/pr/changelog/index.spec.ts @@ -1,5 +1,5 @@ import * as httpMock from '../../../../test/httpMock'; -import { partial } from '../../../../test/util'; +import { getName, partial } from '../../../../test/util'; import { PLATFORM_TYPE_GITHUB } from '../../../constants/platforms'; import * as hostRules from '../../../util/host-rules'; import * as semverVersioning from '../../../versioning/semver'; @@ -31,7 +31,7 @@ const upgrade: BranchConfig = partial<BranchConfig>({ ], }); -describe('workers/pr/changelog', () => { +describe(getName(__filename), () => { describe('getChangeLogJSON', () => { beforeEach(() => { httpMock.setup(); diff --git a/lib/workers/pr/changelog/release-notes.spec.ts b/lib/workers/pr/changelog/release-notes.spec.ts index 484773d0c8..b5d6ff881b 100644 --- a/lib/workers/pr/changelog/release-notes.spec.ts +++ b/lib/workers/pr/changelog/release-notes.spec.ts @@ -1,5 +1,6 @@ import fs from 'fs-extra'; import * as httpMock from '../../../../test/httpMock'; +import { getName } from '../../../../test/util'; import { ChangeLogNotes } from './common'; import { addReleaseNotes, @@ -43,7 +44,7 @@ const contentsResponse = [ { name: 'README.md' }, ]; -describe('workers/pr/release-notes', () => { +describe(getName(__filename), () => { beforeEach(() => { httpMock.setup(); }); diff --git a/lib/workers/pr/changelog/release-notes.ts b/lib/workers/pr/changelog/release-notes.ts index efcdb23cbe..09859f2fdf 100644 --- a/lib/workers/pr/changelog/release-notes.ts +++ b/lib/workers/pr/changelog/release-notes.ts @@ -8,7 +8,7 @@ import * as memCache from '../../../util/cache/memory'; import * as packageCache from '../../../util/cache/package'; import { GithubHttp } from '../../../util/http/github'; import { GitlabHttp } from '../../../util/http/gitlab'; -import { ChangeLogNotes, ChangeLogResult } from './common'; +import { ChangeLogFile, ChangeLogNotes, ChangeLogResult } from './common'; const markdown = new MarkdownIt('zero'); markdown.enable(['heading', 'lheading']); @@ -195,7 +195,7 @@ function isUrl(url: string): boolean { export async function getReleaseNotesMdFileInner( repository: string, apiBaseUrl: string -): Promise<{ changelogFile: string; changelogMd: string }> | null { +): Promise<ChangeLogFile> | null { let changelogFile: string; let apiTree: string; let apiFiles: string; @@ -252,7 +252,7 @@ export async function getReleaseNotesMdFileInner( export function getReleaseNotesMdFile( repository: string, apiBaseUrl: string -): Promise<{ changelogFile: string; changelogMd: string }> | null { +): Promise<ChangeLogFile> | null { const cacheKey = `getReleaseNotesMdFile-${repository}-${apiBaseUrl}`; const cachedResult = memCache.get(cacheKey); // istanbul ignore if diff --git a/lib/workers/pr/changelog/releases.spec.ts b/lib/workers/pr/changelog/releases.spec.ts index 03defd33f0..7e590f6604 100644 --- a/lib/workers/pr/changelog/releases.spec.ts +++ b/lib/workers/pr/changelog/releases.spec.ts @@ -1,4 +1,4 @@ -import { mocked, partial } from '../../../../test/util'; +import { getName, mocked, partial } from '../../../../test/util'; import * as datasource from '../../../datasource'; import * as dockerVersioning from '../../../versioning/docker'; import * as npmVersioning from '../../../versioning/npm'; @@ -9,7 +9,7 @@ jest.mock('../../../datasource'); const ds = mocked(datasource); -describe('workers/pr/changelog/releases', () => { +describe(getName(__filename), () => { describe('getReleaseNotes()', () => { beforeEach(() => { ds.getPkgReleases.mockResolvedValueOnce({ -- GitLab