-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(release): changelog renderer should prefer breaking change explan…
…ation text (#20798)
- Loading branch information
1 parent
71ce32a
commit 32baa4d
Showing
4 changed files
with
175 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -539,4 +539,125 @@ describe('defaultChangelogRenderer()', () => { | |
expect(markdown).toMatchInlineSnapshot(`""`); | ||
}); | ||
}); | ||
|
||
describe('breaking changes', () => { | ||
it('should work for breaking changes with just the ! and no explanation', async () => { | ||
const breakingChangeCommitWithExplanation: GitCommit = { | ||
// ! after the type, no BREAKING CHANGE: in the body | ||
message: 'feat(WebSocketSubject)!: no longer extends `Subject`.', | ||
shortHash: '54f2f6ed1', | ||
author: { | ||
name: 'James Henry', | ||
email: '[email protected]', | ||
}, | ||
body: | ||
'M\tpackages/rxjs/src/internal/observable/dom/WebSocketSubject.ts\n' + | ||
'"', | ||
authors: [ | ||
{ | ||
name: 'James Henry', | ||
email: '[email protected]', | ||
}, | ||
], | ||
description: 'no longer extends `Subject`.', | ||
type: 'feat', | ||
scope: 'WebSocketSubject', | ||
references: [{ value: '54f2f6ed1', type: 'hash' }], | ||
isBreaking: true, | ||
revertedHashes: [], | ||
affectedFiles: [ | ||
'packages/rxjs/src/internal/observable/dom/WebSocketSubject.ts', | ||
], | ||
}; | ||
|
||
const markdown = await defaultChangelogRenderer({ | ||
projectGraph, | ||
commits: [breakingChangeCommitWithExplanation], | ||
releaseVersion: 'v1.1.0', | ||
project: null, | ||
entryWhenNoChanges: false, | ||
changelogRenderOptions: { | ||
includeAuthors: true, | ||
}, | ||
}); | ||
|
||
expect(markdown).toMatchInlineSnapshot(` | ||
"## v1.1.0 | ||
### 🚀 Features | ||
- ⚠️ **WebSocketSubject:** no longer extends \`Subject\`. | ||
#### ⚠️ Breaking Changes | ||
- ⚠️ **WebSocketSubject:** no longer extends \`Subject\`. | ||
### ❤️ Thank You | ||
- James Henry" | ||
`); | ||
}); | ||
|
||
it('should extract the explanation of a breaking change and render it preferentially', async () => { | ||
const breakingChangeCommitWithExplanation: GitCommit = { | ||
// No ! after the type, but BREAKING CHANGE: in the body | ||
message: 'feat(WebSocketSubject): no longer extends `Subject`.', | ||
shortHash: '54f2f6ed1', | ||
author: { | ||
name: 'James Henry', | ||
email: '[email protected]', | ||
}, | ||
body: | ||
'BREAKING CHANGE: `WebSocketSubject` is no longer `instanceof Subject`. Check for `instanceof WebSocketSubject` instead.\n' + | ||
'"\n' + | ||
'\n' + | ||
'M\tpackages/rxjs/src/internal/observable/dom/WebSocketSubject.ts\n' + | ||
'"', | ||
authors: [ | ||
{ | ||
name: 'James Henry', | ||
email: '[email protected]', | ||
}, | ||
], | ||
description: 'no longer extends `Subject`.', | ||
type: 'feat', | ||
scope: 'WebSocketSubject', | ||
references: [{ value: '54f2f6ed1', type: 'hash' }], | ||
isBreaking: true, | ||
revertedHashes: [], | ||
affectedFiles: [ | ||
'packages/rxjs/src/internal/observable/dom/WebSocketSubject.ts', | ||
], | ||
}; | ||
|
||
const markdown = await defaultChangelogRenderer({ | ||
projectGraph, | ||
commits: [breakingChangeCommitWithExplanation], | ||
releaseVersion: 'v1.1.0', | ||
project: null, | ||
entryWhenNoChanges: false, | ||
changelogRenderOptions: { | ||
includeAuthors: true, | ||
}, | ||
}); | ||
|
||
expect(markdown).toMatchInlineSnapshot(` | ||
"## v1.1.0 | ||
### 🚀 Features | ||
- ⚠️ **WebSocketSubject:** no longer extends \`Subject\`. | ||
#### ⚠️ Breaking Changes | ||
- **WebSocketSubject:** \`WebSocketSubject\` is no longer \`instanceof Subject\`. Check for \`instanceof WebSocketSubject\` instead. | ||
### ❤️ Thank You | ||
- James Henry" | ||
`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters