- change the default placeholder pattern from ${{}} to #{{}} as this will work for both config.json files and the yaml (${{}} is reserved for github actions syntax)
This commit is contained in:
@@ -14,6 +14,6 @@ it('Configurations are merged correctly', async () => {
|
||||
|
||||
console.log(mergedConfiguration)
|
||||
expect(JSON.stringify(mergedConfiguration)).toEqual(
|
||||
`{\"max_tags_to_fetch\":200,\"max_pull_requests\":1000,\"max_back_track_time_days\":1000,\"exclude_merge_branches\":[],\"sort\":\"DESC\",\"template\":\"$\{\{CHANGELOG}}\",\"pr_template\":\"- $\{\{TITLE}}\\n - PR: #$\{\{NUMBER}}\",\"empty_template\":\"- no magic changes\",\"categories\":[{\"title\":\"## 🚀 Features\",\"labels\":[\"feature\"]},{\"title\":\"## 🐛 Fixes\",\"labels\":[\"fix\"]},{\"title\":\"## 🧪 Tests\",\"labels\":[\"test\"]}],\"ignore_labels\":[\"ignore\"],\"label_extractor\":[],\"transformers\":[],\"tag_resolver\":{\"method\":\"semver\"},\"base_branches\":[],\"custom_placeholders\":[],\"trim_values\":true}`
|
||||
`{\"max_tags_to_fetch\":200,\"max_pull_requests\":1000,\"max_back_track_time_days\":1000,\"exclude_merge_branches\":[],\"sort\":\"DESC\",\"template\":\"#\{\{CHANGELOG}}\",\"pr_template\":\"- #\{\{TITLE}}\\n - PR: ##\{\{NUMBER}}\",\"empty_template\":\"- no magic changes\",\"categories\":[{\"title\":\"## 🚀 Features\",\"labels\":[\"feature\"]},{\"title\":\"## 🐛 Fixes\",\"labels\":[\"fix\"]},{\"title\":\"## 🧪 Tests\",\"labels\":[\"test\"]}],\"ignore_labels\":[\"ignore\"],\"label_extractor\":[],\"transformers\":[],\"tag_resolver\":{\"method\":\"semver\"},\"base_branches\":[],\"custom_placeholders\":[],\"trim_values\":true}`
|
||||
)
|
||||
})
|
||||
|
||||
@@ -86,7 +86,7 @@ it('Should use empty placeholder', async () => {
|
||||
false, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.0.2-0.0.3_cache.json", // path to the cache
|
||||
'caches/rcba_0.0.2-0.0.3_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -115,7 +115,7 @@ it('Should fill empty placeholders', async () => {
|
||||
false, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.0.2-0.0.3_cache.json", // path to the cache
|
||||
'caches/rcba_0.0.2-0.0.3_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -146,7 +146,7 @@ it('Should fill `template` placeholders', async () => {
|
||||
false, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.0.1-0.0.3_cache.json", // path to the cache
|
||||
'caches/rcba_0.0.1-0.0.3_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -178,7 +178,7 @@ it('Should fill `template` placeholders, ignore', async () => {
|
||||
false, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.9.1-0.9.5_cache.json", // path to the cache
|
||||
'caches/rcba_0.9.1-0.9.5_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -209,7 +209,7 @@ it('Uncategorized category', async () => {
|
||||
false, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.9.1-0.9.5_cache.json", // path to the cache
|
||||
'caches/rcba_0.9.1-0.9.5_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -240,7 +240,7 @@ it('Verify commit based changelog', async () => {
|
||||
true, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/rcba_0.0.1-0.0.3_commit_cache.json", // path to the cache
|
||||
'caches/rcba_0.0.1-0.0.3_commit_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -271,7 +271,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
|
||||
true, // enable commitMode
|
||||
false, // enable exportCache
|
||||
false, // enable exportOnly
|
||||
"caches/stackzy_bd3242-17a9e4_cache.json", // path to the cache
|
||||
'caches/stackzy_bd3242-17a9e4_cache.json', // path to the cache
|
||||
configuration
|
||||
)
|
||||
|
||||
@@ -377,7 +377,7 @@ it('Verify reviewers who approved are fetched and also release information', asy
|
||||
|
||||
it('Fetch release information', async () => {
|
||||
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_approvers.json'))
|
||||
configuration.template = '${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}'
|
||||
configuration.template = '#{{FROM_TAG}}-#{{FROM_TAG_DATE}}\n#{{TO_TAG}}-#{{TO_TAG_DATE}}\n#{{DAYS_SINCE}}'
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null, // baseUrl
|
||||
null, // token
|
||||
@@ -407,7 +407,7 @@ it('Fetch release information', async () => {
|
||||
|
||||
it('Fetch release information for non existing tag / release', async () => {
|
||||
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_approvers.json'))
|
||||
configuration.template = '${{FROM_TAG}}-${{FROM_TAG_DATE}}\n${{TO_TAG}}-${{TO_TAG_DATE}}\n${{DAYS_SINCE}}'
|
||||
configuration.template = '#{{FROM_TAG}}-#{{FROM_TAG_DATE}}\n#{{TO_TAG}}-#{{TO_TAG_DATE}}\n#{{DAYS_SINCE}}'
|
||||
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||
null, // baseUrl
|
||||
null, // token
|
||||
|
||||
@@ -3,7 +3,7 @@ import {Octokit} from '@octokit/rest'
|
||||
import {buildChangelog} from '../src/transform'
|
||||
import {pullData} from '../src/pr-collector/prCollector'
|
||||
import fetch from 'node-fetch'
|
||||
import { Data } from '../src/releaseNotesBuilder'
|
||||
import {Data} from '../src/releaseNotesBuilder'
|
||||
|
||||
jest.setTimeout(180000)
|
||||
|
||||
@@ -37,7 +37,7 @@ it('Should have empty changelog (tags)', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.0.2-0.0.3_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.0.2-0.0.3_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -64,7 +64,7 @@ it('Should match generated changelog (tags)', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.0.1-0.0.3_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.0.1-0.0.3_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -97,7 +97,7 @@ it('Should match generated changelog (refs)', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_5ec7a2-fa3788_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_5ec7a2-fa3788_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -137,7 +137,7 @@ it('Should match generated changelog and replace all occurrences (refs)', async
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_5ec7a2-fa3788_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_5ec7a2-fa3788_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -180,7 +180,7 @@ it('Should match ordered ASC', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.3.0-0.5.0_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -208,7 +208,7 @@ it('Should match ordered DESC', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.3.0-0.5.0_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -235,7 +235,7 @@ it('Should match ordered by title ASC', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.3.0-0.5.0_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -264,7 +264,7 @@ it('Should match ordered by title DESC', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_0.3.0-0.5.0_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -293,7 +293,7 @@ it('Should ignore PRs not merged into develop branch', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_1.3.1-1.4.0_base_develop_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_1.3.1-1.4.0_base_develop_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
@@ -320,7 +320,7 @@ it('Should ignore PRs not merged into main branch', async () => {
|
||||
if (enablePullData) {
|
||||
data = await pullData(octokit, options)
|
||||
} else {
|
||||
data = checkExportedData(false, "caches/rcba_1.3.1-1.4.0_base_main_cache.json")
|
||||
data = checkExportedData(false, 'caches/rcba_1.3.1-1.4.0_base_main_cache.json')
|
||||
}
|
||||
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
|
||||
console.log(changeLog)
|
||||
|
||||
@@ -409,7 +409,7 @@ it('Reference PRs', async () => {
|
||||
labels: []
|
||||
}
|
||||
]
|
||||
customConfig.pr_template = '${{NUMBER}} -- ${{REFERENCED[*].number}}'
|
||||
customConfig.pr_template = '#{{NUMBER}} -- #{{REFERENCED[*].number}}'
|
||||
customConfig.reference = {
|
||||
pattern: '.* #(.).*', // matches the 1 from "abcdefg #1 adfasdf"
|
||||
on_property: 'body',
|
||||
@@ -440,7 +440,7 @@ 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.pr_template = '#{{MERGE_SHA}}'
|
||||
|
||||
const resultChangelog = buildChangelog(DefaultDiffInfo, pullRequestsWithLabels, {
|
||||
owner: 'mikepenz',
|
||||
@@ -461,7 +461,7 @@ it('Commit SHA-1 in commitMode', async () => {
|
||||
|
||||
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',
|
||||
@@ -542,8 +542,8 @@ it('Extract custom placeholder from PR body and replace in global template', asy
|
||||
}
|
||||
]
|
||||
customConfig.template =
|
||||
'${{CHANGELOG}}\n\n${{C_PLACEHOLER_2[2]}}\n\n${{C_PLACEHOLER_2[*]}}${{C_PLACEHOLDER_1[7]}}${{C_PLACEHOLER_2[1493]}}${{C_PLACEHOLER_4[*]}}${{C_PLACEHOLER_4[0]}}${{C_PLACEHOLER_3[1]}}'
|
||||
customConfig.pr_template = '${{BODY}} ----> ${{C_PLACEHOLDER_1}}${{C_PLACEHOLER_3}}'
|
||||
'#{{CHANGELOG}}\n\n#{{C_PLACEHOLER_2[2]}}\n\n#{{C_PLACEHOLER_2[*]}}#{{C_PLACEHOLDER_1[7]}}#{{C_PLACEHOLER_2[1493]}}#{{C_PLACEHOLER_4[*]}}#{{C_PLACEHOLER_4[0]}}#{{C_PLACEHOLER_3[1]}}'
|
||||
customConfig.pr_template = '#{{BODY}} ----> #{{C_PLACEHOLDER_1}}#{{C_PLACEHOLER_3}}'
|
||||
|
||||
expect(buildChangelogTest(customConfig, mergedPullRequests)).toStrictEqual(
|
||||
`## 🚀 Features\n\nno magic body1 for this matter ----> - body1body1\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`
|
||||
|
||||
Reference in New Issue
Block a user