- recompile dist

This commit is contained in:
Mike Penz
2022-07-30 09:04:48 +02:00
parent 2f418c46e5
commit 4cc48881f7
6 changed files with 150 additions and 221 deletions
+31 -59
View File
@@ -14,8 +14,8 @@ it('Should have empty changelog (tags)', async () => {
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.0.1' },
toTag: { name: 'v0.0.2' },
fromTag: {name: 'v0.0.1'},
toTag: {name: 'v0.0.2'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -26,7 +26,7 @@ it('Should have empty changelog (tags)', async () => {
const changeLog = await releaseNotes.pull()
console.log(changeLog)
expect(changeLog).toStrictEqual("- no changes")
expect(changeLog).toStrictEqual('- no changes')
})
it('Should match generated changelog (tags)', async () => {
@@ -34,8 +34,8 @@ it('Should match generated changelog (tags)', async () => {
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.0.1'},
toTag: { name: 'v0.0.3' },
fromTag: {name: 'v0.0.1'},
toTag: {name: 'v0.0.3'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -55,15 +55,12 @@ it('Should match generated changelog (tags)', async () => {
})
it('Should match generated changelog (refs)', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_all_placeholders.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_all_placeholders.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3' },
toTag: { name: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa' },
fromTag: {name: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3'},
toTag: {name: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -91,15 +88,12 @@ nhoelzl
})
it('Should match generated changelog and replace all occurrences (refs)', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_replace_all_placeholders.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_replace_all_placeholders.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3' },
toTag: { name: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa' },
fromTag: {name: '5ec7a2d86fe9f43fdd38d5e254a1117c8a51b4c3'},
toTag: {name: 'fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -129,15 +123,12 @@ nhoelzl
})
it('Should match ordered ASC', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_asc.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_asc.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.3.0' },
toTag: { name: 'v0.5.0' },
fromTag: {name: 'v0.3.0'},
toTag: {name: 'v0.5.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -148,21 +139,16 @@ it('Should match ordered ASC', async () => {
const changeLog = await releaseNotes.pull()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`## 🚀 Features\n\n22\n24\n25\n26\n28\n\n## 🐛 Fixes\n\n23\n\n`
)
expect(changeLog).toStrictEqual(`## 🚀 Features\n\n22\n24\n25\n26\n28\n\n## 🐛 Fixes\n\n23\n\n`)
})
it('Should match ordered DESC', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_desc.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_desc.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.3.0' },
toTag: { name: 'v0.5.0' },
fromTag: {name: 'v0.3.0'},
toTag: {name: 'v0.5.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -173,21 +159,16 @@ it('Should match ordered DESC', async () => {
const changeLog = await releaseNotes.pull()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`## 🚀 Features\n\n28\n26\n25\n24\n22\n\n## 🐛 Fixes\n\n23\n\n`
)
expect(changeLog).toStrictEqual(`## 🚀 Features\n\n28\n26\n25\n24\n22\n\n## 🐛 Fixes\n\n23\n\n`)
})
it('Should match ordered by title ASC', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_sort_title_asc.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_sort_title_asc.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.3.0' },
toTag: { name: 'v0.5.0' },
fromTag: {name: 'v0.3.0'},
toTag: {name: 'v0.5.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -204,15 +185,12 @@ it('Should match ordered by title ASC', async () => {
})
it('Should match ordered by title DESC', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_sort_title_desc.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_sort_title_desc.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v0.3.0' },
toTag: { name: 'v0.5.0' },
fromTag: {name: 'v0.3.0'},
toTag: {name: 'v0.5.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -229,15 +207,12 @@ it('Should match ordered by title DESC', async () => {
})
it('Should ignore PRs not merged into develop branch', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_base_branches_develop.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_base_branches_develop.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v1.3.1' },
toTag: { name: 'v1.4.0' },
fromTag: {name: 'v1.3.1'},
toTag: {name: 'v1.4.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -252,15 +227,12 @@ it('Should ignore PRs not merged into develop branch', async () => {
})
it('Should ignore PRs not merged into main branch', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_base_branches_main.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_base_branches_main.json')
const releaseNotes = new ReleaseNotes(octokit, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v1.3.1' },
toTag: { name: 'v1.4.0' },
fromTag: {name: 'v1.3.1'},
toTag: {name: 'v1.4.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
+54 -92
View File
@@ -53,9 +53,7 @@ it('Should match generated changelog (unspecified tags)', async () => {
const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`## 🐛 Fixes\n\n- Stacktrace Data can be an array\n - PR: #39\n\n`
)
expect(changeLog).toStrictEqual(`## 🐛 Fixes\n\n- Stacktrace Data can be an array\n - PR: #39\n\n`)
})
it('Should use empty placeholder', async () => {
@@ -83,10 +81,7 @@ it('Should use empty placeholder', async () => {
})
it('Should fill empty placeholders', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_empty_all_placeholders.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_empty_all_placeholders.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -112,10 +107,7 @@ it('Should fill empty placeholders', async () => {
})
it('Should fill `template` placeholders', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_empty_all_placeholders.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_empty_all_placeholders.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -141,10 +133,7 @@ it('Should fill `template` placeholders', async () => {
})
it('Should fill `template` placeholders, ignore', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_empty_all_placeholders.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_empty_all_placeholders.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -170,10 +159,7 @@ it('Should fill `template` placeholders, ignore', async () => {
})
it('Uncategorized category', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_uncategorized_category.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_uncategorized_category.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -199,10 +185,7 @@ it('Uncategorized category', async () => {
})
it('Verify commit based changelog', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_commits.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_commits.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -228,10 +211,7 @@ it('Verify commit based changelog', async () => {
})
it('Verify commit based changelog, with emoji categorisation', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_commits_emoji.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_commits_emoji.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null,
null,
@@ -257,25 +237,22 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
})
it('Verify default inclusion of open PRs', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_including_open.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_including_open.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // enable to fetch tag release information
false, // commitMode
configuration // configuration
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
@@ -286,25 +263,22 @@ it('Verify default inclusion of open PRs', async () => {
})
it('Verify custom categorisation of open PRs', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_excluding_open.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_excluding_open.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // enable to fetch tag release information
false, // commitMode
configuration // configuration
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
@@ -315,25 +289,22 @@ it('Verify custom categorisation of open PRs', async () => {
})
it('Verify reviewers who approved are fetched and also release information', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_approvers.json'
)
const configuration = resolveConfiguration('', 'configs_test/configuration_approvers.json')
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'1.5.0', // fromTag
'2.0.0', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
true, // enable to fetch reviewers
true, // enable to fetch reviewers
true, // enable to fetch tag release information
false, // commitMode
configuration // configuration
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
@@ -343,61 +314,52 @@ it('Verify reviewers who approved are fetched and also release information', asy
)
})
it('Fetch release information', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_approvers.json'
)
configuration.template = "${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}"
const configuration = resolveConfiguration('', 'configs_test/configuration_approvers.json')
configuration.template = '${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}'
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'2.0.0', // fromTag
'3.0.0-a01', // toTag
true, // includeOpen
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'2.0.0', // fromTag
'3.0.0-a01', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // enable to fetch reviewers
true, // enable to fetch tag release information
false, // commitMode
configuration // configuration
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(
`2.0.0-2022-04-08T07:52:40.000Z\n3.0.0-a01-2022-07-26T14:28:36.000Z\n109`
)
expect(changeLog).toStrictEqual(`2.0.0-2022-04-08T07:52:40.000Z\n3.0.0-a01-2022-07-26T14:28:36.000Z\n109`)
})
it('Fetch release information for non existing tag / release', async () => {
const configuration = resolveConfiguration(
'',
'configs_test/configuration_approvers.json'
)
configuration.template = "${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}"
const configuration = resolveConfiguration('', 'configs_test/configuration_approvers.json')
configuration.template = '${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}'
const releaseNotesBuilder = new ReleaseNotesBuilder(
null, // baseUrl
null, // token
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'2.0.0', // fromTag
'3.0.1', // toTag
true, // includeOpen
'.', // repoPath
'mikepenz', // user
'release-changelog-builder-action-playground', // repo
'2.0.0', // fromTag
'3.0.1', // toTag
true, // includeOpen
false, // failOnError
false, // ignorePrePrelease
false, // enable to fetch reviewers
false, // enable to fetch reviewers
true, // enable to fetch tag release information
false, // commitMode
configuration // configuration
configuration // configuration
)
const changeLog = await releaseNotesBuilder.build()
console.log(changeLog)
expect(changeLog).toStrictEqual(`- no changes`)
})
})
+5 -7
View File
@@ -1,4 +1,4 @@
import { TagInfo, sortTags, filterTags } from '../src/tags';
import {TagInfo, sortTags, filterTags} from '../src/tags'
jest.setTimeout(180000)
@@ -108,8 +108,8 @@ it('Should filter tags correctly using the regex', async () => {
const tagResolver = {
method: 'non-existing-method',
filter: {
"pattern": "api-(.+)",
"flags": "gu"
pattern: 'api-(.+)',
flags: 'gu'
}
}
const filtered = filterTags(tags, tagResolver)
@@ -118,7 +118,5 @@ it('Should filter tags correctly using the regex', async () => {
})
.join(',')
expect(filtered).toStrictEqual(
`api-0.0.1,api-0.0.1-rc01,api-10.1.0-2`
)
})
expect(filtered).toStrictEqual(`api-0.0.1,api-0.0.1-rc01,api-10.1.0-2`)
})
+57 -60
View File
@@ -1,8 +1,8 @@
import {buildChangelog} from '../src/transform'
import {PullRequestInfo} from '../src/pullRequests'
import moment from 'moment'
import { Configuration, DefaultConfiguration } from '../src/configuration';
import { DefaultDiffInfo } from '../src/commits';
import {Configuration, DefaultConfiguration} from '../src/configuration'
import {DefaultDiffInfo} from '../src/commits'
jest.setTimeout(180000)
@@ -45,7 +45,7 @@ mergedPullRequests.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 2,
@@ -63,7 +63,7 @@ mergedPullRequests.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 3,
@@ -81,7 +81,7 @@ mergedPullRequests.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 4,
@@ -99,7 +99,7 @@ mergedPullRequests.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
}
)
@@ -119,7 +119,7 @@ const pullRequestWithLabelInBody: PullRequestInfo = {
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
}
it('Extract label from title, combined regex', async () => {
@@ -134,8 +134,8 @@ it('Extract label from title, combined regex', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -149,7 +149,6 @@ it('Extract label from title, combined regex', async () => {
)
})
it('Extract label from title and body, combined regex', async () => {
configuration.label_extractor = [
{
@@ -158,14 +157,14 @@ it('Extract label from title and body, combined regex', async () => {
on_property: ['title', 'body']
}
]
let prs = Array.from(mergedPullRequests)
prs.push(pullRequestWithLabelInBody)
const resultChangelog = buildChangelog(DefaultDiffInfo, prs, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -196,8 +195,8 @@ it('Extract label from title, split regex', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -228,8 +227,8 @@ it('Extract label from title, match', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -255,8 +254,8 @@ it('Extract label from title, match multiple', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -283,8 +282,8 @@ it('Extract label from title, match multiple, custon non matching label', async
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -317,7 +316,7 @@ pullRequestsWithLabels.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 2,
@@ -335,7 +334,7 @@ pullRequestsWithLabels.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 3,
@@ -353,7 +352,7 @@ pullRequestsWithLabels.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
},
{
number: 4,
@@ -371,7 +370,7 @@ pullRequestsWithLabels.push(
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: "merged"
status: 'merged'
}
)
@@ -398,8 +397,8 @@ it('Match multiple labels exhaustive for category', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -424,8 +423,8 @@ it('Deduplicate duplicated PRs', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -441,7 +440,7 @@ it('Deduplicate duplicated PRs', async () => {
it('Deduplicate duplicated PRs DESC', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.sort = "DESC"
customConfig.sort = 'DESC'
customConfig.duplicate_filter = {
pattern: '\\[ABC-....\\]',
on_property: 'title',
@@ -451,8 +450,8 @@ it('Deduplicate duplicated PRs DESC', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -466,26 +465,25 @@ it('Deduplicate duplicated PRs DESC', async () => {
)
})
it('Use empty_content for empty category', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.categories = [
{
title: '## 🚀 Features and 🐛 Issues',
labels: ['Never-Matching-Category'],
empty_content: "- No PRs in this category"
empty_content: '- No PRs in this category'
},
{
title: '## 🚀 Features',
labels: ['Feature'],
labels: ['Feature']
}
]
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -501,14 +499,14 @@ it('Use empty_content for empty category', async () => {
it('Commit SHA-1 in commitMode', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.sort = "DESC"
customConfig.pr_template = "${{MERGE_SHA}}"
customConfig.sort = 'DESC'
customConfig.pr_template = '${{MERGE_SHA}}'
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -517,20 +515,18 @@ it('Commit SHA-1 in commitMode', async () => {
configuration: customConfig
})
expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\nsha1-3\nsha1-1\n\n## 🐛 Fixes\n\nsha1-3\nsha1-2\n\n`
)
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\nsha1-3\nsha1-1\n\n## 🐛 Fixes\n\nsha1-3\nsha1-2\n\n`)
})
it('Release Diff', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.template = "${{RELEASE_DIFF}}\n${{DAYS_SINCE}}"
customConfig.template = '${{RELEASE_DIFF}}\n${{DAYS_SINCE}}'
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: { name: 'v2.8.0' },
toTag: { name: 'v2.8.1' },
fromTag: {name: 'v2.8.0'},
toTag: {name: 'v2.8.1'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -544,7 +540,6 @@ it('Release Diff', async () => {
)
})
it('Use exclude labels to not include a PR within a category.', async () => {
const customConfig = Object.assign({}, DefaultConfiguration)
customConfig.categories = [
@@ -569,8 +564,8 @@ it('Use exclude labels to not include a PR within a category.', async () => {
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -584,35 +579,35 @@ it('Use exclude labels to not include a PR within a category.', async () => {
)
})
it('Extract custom placeholder from PR body and replace in global template', async () => {
const customConfig = Object.assign({}, configuration)
customConfig.custom_placeholders = [
{
name: "C_PLACEHOLDER_1",
source: "BODY",
name: 'C_PLACEHOLDER_1',
source: 'BODY',
transformer: {
pattern: '.+ (b....).+',
target: '- $1'
}
},
{
name: "C_PLACEHOLER_2",
source: "BODY",
name: 'C_PLACEHOLER_2',
source: 'BODY',
transformer: {
pattern: '.+ b(....).+',
target: '\n- $1'
}
}
]
customConfig.template = "${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}"
customConfig.pr_template = "${{BODY}} ----> ${{C_PLACEHOLDER_1}}"
customConfig.template =
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}'
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}'
const resultChangelog = buildChangelog(DefaultDiffInfo, mergedPullRequests, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: { name: '1.0.0' },
toTag: { name: '2.0.0' },
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
@@ -621,5 +616,7 @@ it('Extract custom placeholder from PR body and replace in global template', asy
configuration: customConfig
})
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\nno magic body1 for this matter ----> - body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4`)
expect(resultChangelog).toStrictEqual(
`## 🚀 Features\n\nno magic body1 for this matter ----> - body1\nno magic body3 for this matter ----> - body3\n\n## 🐛 Fixes\n\nno magic body2 for this matter ----> - body2\nno magic body3 for this matter ----> - body3\n\n## 🧪 Others\n\nno magic body4 for this matter ----> - body4\n\n\n\n\n- ody3\n\n\n- ody1\n- ody2\n- ody3\n- ody4`
)
})
Generated Vendored
+2 -2
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long