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

Don't escape hyphens for Regex #1574

Merged
merged 1 commit into from
Sep 2, 2016
Merged

Don't escape hyphens for Regex #1574

merged 1 commit into from
Sep 2, 2016

Conversation

insin
Copy link
Contributor

@insin insin commented Sep 2, 2016

This fixes facebook/create-react-app#542 for me locally

@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

Hmmm.. I'm trying to figure out if we need to ever escape hyphen when we always escape square brackets – I think not. This is probably whatever people on stack overflow recommend to use and I think it might be flawed :)

cc @davidaurelio what do you think?

@insin
Copy link
Contributor Author

insin commented Sep 2, 2016

Hmmm.. I'm trying to figure out if we need to ever escape hyphen when we always escape square brackets – I think not.

Agreed, as hyphens are only "special" inside square brackets, and even then it depends on where the hyphen is (thanks, Regexps!)

The obligatory @sindresorhus module doesn't escape them either: https://github.com/sindresorhus/escape-string-regexp/blob/master/index.js 😸

@ghost ghost added CLA Signed ✔️ labels Sep 2, 2016
@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

awesome, thank you so much for the quick fix. I'll publish a fix for Jest tomorrow morning.

This also fixes #1551.

@codecov-io
Copy link

codecov-io commented Sep 2, 2016

Current coverage is 90.29% (diff: 100%)

Merging #1574 into master will not change coverage

@@             master      #1574   diff @@
==========================================
  Files            28         28          
  Lines          1123       1123          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           1014       1014          
  Misses          109        109          
  Partials          0          0          

Powered by Codecov. Last update 3e141f0...c43fb67

@pavlin99th
Copy link

I ended up with the exact same fix for windows.
What about other special symbols? Someone crazy may create folder a[x-z]$c.

@cpojer cpojer merged commit c7a3e0c into jestjs:master Sep 2, 2016
@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

We'll figure out where to go from here and how to put a lasting fix in place. We are still working on getting Jest's tests onto AppVeyor.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default test not found if project path contains hyphens
5 participants