Skip to content
Snippets Groups Projects
Unverified Commit 34d64832 authored by Luca Becker's avatar Luca Becker Committed by GitHub
Browse files

feat(release-notes): running unemojify on release notes (#9535)

parent dd26fcf2
No related branches found
No related tags found
No related merge requests found
import { getName } from '../../test/util';
import { setEmojiConfig, unemojify } from './emoji';
describe(getName(__filename), () => {
it('strips emojis when the config has been set accordingly', () => {
const emoji = '🚀💎';
const otherText = 'regular text';
const text = `${emoji} ${otherText}`;
setEmojiConfig({ unicodeEmoji: false });
const result = unemojify(text);
expect(result).not.toContain(emoji);
});
it('does not strip emojis when the config demands it', () => {
const emoji = '🚀💎';
const otherText = 'regular text';
const text = `${emoji} ${otherText}`;
setEmojiConfig({ unicodeEmoji: true });
const result = unemojify(text);
expect(result).toEqual(text);
});
});
...@@ -10,3 +10,7 @@ export function setEmojiConfig(_config: RenovateConfig): void { ...@@ -10,3 +10,7 @@ export function setEmojiConfig(_config: RenovateConfig): void {
export function emojify(text: string): string { export function emojify(text: string): string {
return unicodeEmoji ? emoji.emojify(text) : text; return unicodeEmoji ? emoji.emojify(text) : text;
} }
export function unemojify(text: string): string {
return unicodeEmoji ? text : emoji.unemojify(text);
}
import { unemojify } from '../../../util/emoji';
import { sanitizeMarkdown } from '../../../util/markdown'; import { sanitizeMarkdown } from '../../../util/markdown';
import * as template from '../../../util/template'; import * as template from '../../../util/template';
import type { BranchConfig } from '../../types'; import type { BranchConfig } from '../../types';
...@@ -13,5 +14,7 @@ export function getChangelogs(config: BranchConfig): string { ...@@ -13,5 +14,7 @@ export function getChangelogs(config: BranchConfig): string {
'\n\n---\n\n' + template.compile(releaseNotesHbs, config, false) + '\n\n'; '\n\n---\n\n' + template.compile(releaseNotesHbs, config, false) + '\n\n';
releaseNotes = releaseNotes.replace(/### \[`vv/g, '### [`v'); releaseNotes = releaseNotes.replace(/### \[`vv/g, '### [`v');
releaseNotes = sanitizeMarkdown(releaseNotes); releaseNotes = sanitizeMarkdown(releaseNotes);
releaseNotes = unemojify(releaseNotes);
return releaseNotes; return releaseNotes;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment