Skip to content

Commit 17ce224

Browse files
committed
test: add cveId tests
1 parent 43d428b commit 17ce224

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/test-and-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Checkout Repository
1414
uses: actions/checkout@v4
1515
with:
16-
fetch-depth: 0
16+
ref: ${{ github.event.pull_request.head.sha }}
1717
- name: Use Node.js ${{ matrix.node }}
1818
uses: actions/[email protected]
1919
with:

commit-to-output.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export const formatType = {
3939

4040
function toStringPlaintext (data) {
4141
let s = ''
42+
4243
if (data.cveId) {
43-
const pr = data.pr ? data.prUrl : ''
44-
return ` * ${data.cveId} - ${data.summary.trim()} - ${pr}`
44+
s += `(${data.cveId})`
4545
}
4646

4747
s += (data.semver || []).length ? `(${data.semver.join(', ').toUpperCase()}) ` : ''
@@ -98,11 +98,7 @@ function toStringMarkdown (data) {
9898
}
9999

100100
function toStringMessageOnly (data) {
101-
let cveData
102-
if (data.cveId) {
103-
cveData = `${data.cveId} - `
104-
}
105-
return ` * ${cveData}${data.summary.trim()}`
101+
return ` * ${data.cveId ? '(' + data.cveId + ') ' : ''}${data.summary.trim()}`
106102
}
107103

108104
export function commitToOutput (commit, format, ghId, commitUrl) {

test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,12 @@ test('test find-matching-prs', (t) => {
142142
`)
143143
t.end()
144144
})
145+
146+
test('test group, CVE-ID', (t) => {
147+
const out = exec('--md --start-ref=43d428b3d2 --end-ref=43d428b3d2 --group --filter-release')
148+
t.equal(
149+
out,
150+
`* \\[[\`43d428b3d2\`](https://github.com/nodejs/changelog-maker/commit/43d428b3d2)] - **(CVE-2024-22020)** **feat**: add cveId support to commmit output (RafaelGSS) [nodejs/node#55819](https://github.com/nodejs/node/pull/55819)
151+
`)
152+
t.end()
153+
})

0 commit comments

Comments
 (0)