Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Add escapeRegExp tests#2809
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coderabbitaibot commentedJun 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
WalkthroughA new test file was introduced to validate the behavior of the Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat withCodeRabbit:
SupportNeed help? Create a ticket on oursupport page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Important
Looks good to me! 👍
Reviewed everything up todbc12c9 in 42 seconds. Click for details.
- Reviewed
38lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify yoursettings andrules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1.src/pure-functions/escape-regexp.spec.ts:1
- Draft comment:
The shebang at the top is uncommon in test files. Consider removing it unless you require direct execution, as it might affect cross-platform compatibility. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2.src/pure-functions/escape-regexp.spec.ts:27
- Draft comment:
The tests cover typical strings and a full set of regex special characters. Consider adding additional edge cases (e.g. empty string, string with only special characters) to fully validate the function's behavior. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID:wflow_UOhX1kQqW5uzMmY5
You can customize by changing yourverbosity settings, reacting with 👍 or 👎,replying to comments, or addingcode review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/pure-functions/escape-regexp.spec.ts (2)
21-25:Drop the unnecessaryasyncwrapper to reduce overhead
escapeRegExp()is synchronous and the test body contains noawait.
Removingasyncavoids wrapping the result in a (discarded) Promise and keeps the test definition minimal.-test('escapeRegExp() with typical string', async t => {+test('escapeRegExp() with typical string', t => {
27-32:Expand the “special-char” case to include all characters the implementation escapesThe current input omits
-and/, which are explicitly covered by the regex inescapeRegExp().
Adding them strengthens the regression-proof surface of the test without extra cost.- const input = '.*+?^${}()|[]\\'- const expected = '\\.\\*\\+\\?\\^\\$\\{\\}\\(\\)\\|\\[\\]\\\\'+ const input = '.-*+/+?^${}()|[]\\'+ const expected = '\\.\\-\\*\\+\\/\\+\\?\\^\\$\\{\\}\\(\\)\\|\\[\\]\\\\'Alternatively, add a third test dedicated to
-/so the current expectations stay readable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pure-functions/escape-regexp.spec.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/pure-functions/escape-regexp.spec.ts (1)
src/pure-functions/escape-regexp.ts (1)
escapeRegExp(20-22)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build
- GitHub Check: Build
Uh oh!
There was an error while loading.Please reload this page.
Summary
escapeRegExpTesting
npm run test:unit(fails: cross-env not found)https://chatgpt.com/codex/tasks/task_e_685118b4466c8324a7b93ba6fbedaced
Important
Add unit tests for
escapeRegExpto verify handling of typical strings and regex special characters.escapeRegExpinescape-regexp.spec.ts.escapeRegExp()with typical strings to ensure they remain unchanged.escapeRegExp()with regex special characters to ensure they are escaped with backslashes.This description was created by
fordbc12c9. You cancustomize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit