Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev dependencies #1226

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions __tests__/releaseNotesBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ it('Should use empty placeholder', async () => {
false, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.0.2-0.0.3_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -115,7 +115,7 @@ it('Should fill empty placeholders', async () => {
false, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.0.2-0.0.3_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -146,7 +146,7 @@ it('Should fill `template` placeholders', async () => {
false, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.0.1-0.0.3_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -178,7 +178,7 @@ it('Should fill `template` placeholders, ignore', async () => {
false, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.9.1-0.9.5_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -209,7 +209,7 @@ it('Uncategorized category', async () => {
false, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.9.1-0.9.5_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -240,7 +240,7 @@ it('Verify commit based changelog', async () => {
true, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/rcba_0.0.1-0.0.3_commit_cache.json", // path to the cache
configuration
)

Expand Down Expand Up @@ -271,7 +271,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
true, // enable commitMode
false, // enable exportCache
false, // enable exportOnly
null, // path to the cache
"caches/stackzy_bd3242-17a9e4_cache.json", // path to the cache
configuration
)

Expand Down
83 changes: 65 additions & 18 deletions __tests__/releaseNotesBuilderPull.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {mergeConfiguration, resolveConfiguration} from '../src/utils'
import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../src/utils'
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'

jest.setTimeout(180000)

// load octokit instance
const enablePullData = false // if false -> use cache for data
const octokit = new Octokit({
auth: `token ${process.env.GITHUB_TOKEN}`,
request: {
Expand All @@ -20,8 +22,8 @@ it('Should have empty changelog (tags)', async () => {
const options = {
owner: 'mikepenz',
repo: 'release-changelog-builder-action',
fromTag: {name: 'v0.0.1'},
toTag: {name: 'v0.0.2'},
fromTag: {name: 'v0.0.2'},
toTag: {name: 'v0.0.3'},
includeOpen: false,
failOnError: false,
fetchViaCommits: true,
Expand All @@ -31,7 +33,12 @@ it('Should have empty changelog (tags)', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)
let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.0.2-0.0.3_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual('- no changes')
Expand All @@ -53,8 +60,12 @@ it('Should match generated changelog (tags)', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)

let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.0.1-0.0.3_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(`## 🧪 Tests
Expand Down Expand Up @@ -82,8 +93,12 @@ it('Should match generated changelog (refs)', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)

let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_5ec7a2-fa3788_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(`## 🧪 Tests
Expand Down Expand Up @@ -118,7 +133,12 @@ it('Should match generated changelog and replace all occurrences (refs)', async
commitMode: false,
configuration
}
const data = await pullData(octokit, options)
let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_5ec7a2-fa3788_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(`## 🧪 Tests
Expand Down Expand Up @@ -156,8 +176,12 @@ it('Should match ordered ASC', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)

let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(`## 🚀 Features\n\n22\n24\n25\n26\n28\n\n## 🐛 Fixes\n\n23\n\n`)
Expand All @@ -180,8 +204,12 @@ it('Should match ordered DESC', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)

let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(`## 🚀 Features\n\n28\n26\n25\n24\n22\n\n## 🐛 Fixes\n\n23\n\n`)
Expand All @@ -203,7 +231,12 @@ it('Should match ordered by title ASC', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)
let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(
Expand All @@ -227,8 +260,12 @@ it('Should match ordered by title DESC', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)

let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
data = checkExportedData(false, "caches/rcba_0.3.0-0.5.0_cache.json")
}
const changeLog = buildChangelog(data!.diffInfo, data!.mergedPullRequests, options)
console.log(changeLog)
expect(changeLog).toStrictEqual(
Expand All @@ -252,7 +289,12 @@ it('Should ignore PRs not merged into develop branch', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)
let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
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)
expect(changeLog).toStrictEqual(`150\n\n`)
Expand All @@ -274,7 +316,12 @@ it('Should ignore PRs not merged into main branch', async () => {
commitMode: false,
configuration
}
const data = await pullData(octokit, options)
let data: any
if (enablePullData) {
data = await pullData(octokit, options)
} else {
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)
expect(changeLog).toStrictEqual(`153\n\n`)
Expand Down
133 changes: 133 additions & 0 deletions caches/rcba_0.0.1-0.0.3_cache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"mergedPullRequests": [
{
"number": 10,
"title": "[CI] Specify Test Case",
"htmlURL": "https://github.com/mikepenz/release-changelog-builder-action/pull/10",
"baseBranch": "develop",
"branch": "feature/specify_test",
"createdAt": "2020-10-16T13:58:49.000Z",
"mergedAt": "2020-10-16T13:59:36.000Z",
"mergeCommitSha": "fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa",
"author": "mikepenz",
"repoName": "mikepenz/release-changelog-builder-action",
"labels": [
"test",
"--rcba-merged"
],
"milestone": "1.0.0",
"body": "- specify test case",
"assignees": [
"mikepenz",
"nhoelzl"
],
"requestedReviewers": [
"nhoelzl"
],
"approvedReviewers": [],
"status": "merged"
}
],
"diffInfo": {
"changedFiles": 19,
"additions": 14827,
"deletions": 444,
"changes": 15271,
"commits": 3,
"commitInfo": [
{
"sha": "0a66008df0b0a89c4bcfd447c5457e223f4b9947",
"summary": "- introduce proper approach to retrieve tag before a given tag",
"message": "- introduce proper approach to retrieve tag before a given tag\n- add configuration options for\n - path\n - configuration\n - fromTag, toTag\n - token\n- allow to specify transformers to adjust information to a specific form\n- allow to specify different templates\n- speed up by limiting information to pull\n- add logic to automatically resolve current\n- use github actions logger",
"author": "mikepenz",
"authorDate": "2020-10-16T13:52:24.000Z",
"committer": "mikepenz",
"commitDate": "2020-10-16T13:52:24.000Z"
},
{
"sha": "92577cd8be4b0ff97648fcf6db98ba38dcba1f25",
"summary": "- configure test case",
"message": "- configure test case",
"author": "mikepenz",
"authorDate": "2020-10-16T13:56:40.000Z",
"committer": "mikepenz",
"commitDate": "2020-10-16T13:56:40.000Z"
},
{
"sha": "fa3788c8c4b3373ef8424ce3eb008a5cd07cc5aa",
"summary": "Merge pull request #10 from mikepenz/feature/specify_test",
"message": "Merge pull request #10 from mikepenz/feature/specify_test\n\n[CI] Specify Test Case",
"author": "mikepenz",
"authorDate": "2020-10-16T13:59:35.000Z",
"committer": "web-flow",
"commitDate": "2020-10-16T13:59:35.000Z"
}
]
},
"options": {
"owner": "mikepenz",
"repo": "release-changelog-builder-action",
"fromTag": {
"name": "v0.0.1",
"commit": "v0.0.1"
},
"toTag": {
"name": "v0.0.3",
"commit": "v0.0.3"
},
"includeOpen": false,
"failOnError": false,
"fetchReviewers": false,
"fetchReleaseInformation": false,
"fetchReviews": false,
"commitMode": false,
"configuration": {
"max_tags_to_fetch": 200,
"max_pull_requests": 1000,
"max_back_track_time_days": 1000,
"exclude_merge_branches": [],
"sort": {
"order": "ASC",
"on_property": "mergedAt"
},
"template": "${{CHANGELOG}}\n${{UNCATEGORIZED}}\n${{IGNORED}}\n${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}\n${{RELEASE_DIFF}}\n${{CATEGORIZED_COUNT}}\n${{UNCATEGORIZED_COUNT}}\n${{IGNORED_COUNT}}\n${{CHANGED_FILES}}\n${{ADDITIONS}}\n${{DELETIONS}}\n${{CHANGES}}\n${{COMMITS}}",
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}",
"empty_template": "${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}\n${{RELEASE_DIFF}}",
"categories": [
{
"title": "## 🚀 Features",
"labels": [
"feature"
]
},
{
"title": "## 🐛 Fixes",
"labels": [
"fix"
]
},
{
"title": "## 🧪 Tests",
"labels": [
"test"
]
},
{
"title": "## 📦 Uncategorized",
"labels": []
}
],
"ignore_labels": [
"ignore"
],
"label_extractor": [],
"transformers": [],
"tag_resolver": {
"method": "semver"
},
"base_branches": [],
"custom_placeholders": [],
"trim_values": false
}
}
}
Loading
Loading