Adds rocket, fire and sparkle emoji to the built-in replacements so they show up as words in slugs, and documents it in the readme.
Activity
4CI failure diagnosis
Root cause: emoji.test.js:13 has a typo in its expected value, independent of this PR's overridable-replacements.js changes.
t.is(slugify('New ✨ release', {customReplacements: emojiReplacements}), 'new-sparkles-release');The emojiReplacements array defined at the top of the same test file maps ✨ to the singular word ' sparkle ':
const emojiReplacements = [
['🚀', ' rocket '],
['🔥', ' fire '],
['✨', ' sparkle '],
];Since customReplacements passed to slugify() overrides the built-in map (index.js, where options.customReplacements is spread after builtinOverridableReplacements), the actual output is 'new-sparkle-release', not 'new-sparkles-release'. Confirmed by running:
$ npx ava emoji.test.js
✘ common emoji
Difference (- actual, + expected):
- 'new-sparkle-release'
+ 'new-sparkles-release'This is not introduced by this PR — the same assertion fails identically on main at the base commit (4ef02f6, "Add emoji.test.js"), since emoji.test.js already existed there with the same typo. This PR's own changes (overridable-replacements.js, readme.md) are correct and unaffected.
Fix: change the expected string on line 13 to match the singular word actually used in the test's replacement map:
- t.is(slugify('New ✨ release', {customReplacements: emojiReplacements}), 'new-sparkles-release');
+ t.is(slugify('New ✨ release', {customReplacements: emojiReplacements}), 'new-sparkle-release');Verified locally: with that one-line change, npx ava passes all 26 tests (no regressions).
Why I didn't push a fix: this automation's token is scoped to repo:read/pulls:read/pulls:comment/files:read only (no repo:write), so I can't push to feat/emoji-slugs. The patch above is a one-line, low-risk change to apply directly, or grant write access and re-run.
Reviewed the diff and ran the added test locally. The emoji replacements themselves (🚀/🔥/✨) and the readme update look fine, but the new test file has a failing assertion — see inline comment. Running
npx ava emoji.test.jsagainst this branch fails right now, so this will also fail CI as-is. Please fix the expected string (or the replacement word) before merge; no other correctness/security issues found in this small diff.