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

fix: search and replace of special annotations #735

Merged
merged 4 commits into from
Mar 2, 2024

Conversation

mesaugat
Copy link
Contributor

@mesaugat mesaugat commented Feb 27, 2024

Current Problem

There isn't a way to tag authors as the annotation @@author is replaced by author.

expect(searchAndReplaceSpecialAnnotations('this is @@author', payload)).toBe('this is @creator')

    Expected: "this is @creator"
    Received: "this is  creator"
expect(searchAndReplaceSpecialAnnotations('this is something@author', payload)).toBe('this is somethingcreator')

    Expected: "this is somethingcreator"
    Received: "this is somethin creator"

Solution

Use a negative lookbehind ?<!\\\\${annotation} to not match escaped annotations. The previous regex used to match any character before @author and would replace it with " author".

I have also added a couple of new tests to test the search and replace functionality.

@mesaugat mesaugat changed the title fix: string repl fix: search and replace of special annotations Feb 27, 2024
Copy link

codecov bot commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.91%. Comparing base (a026f67) to head (b875739).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #735   +/-   ##
=======================================
  Coverage   92.91%   92.91%           
=======================================
  Files         110      110           
  Lines        2878     2878           
  Branches      577      577           
=======================================
  Hits         2674     2674           
  Misses        185      185           
  Partials       19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shine2lay shine2lay merged commit c6d0d68 into mergeability:master Mar 2, 2024
4 checks passed
Copy link

🎉 This PR is included in version 2.17.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants