You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The moduleNameMapper configuration only works with regexes that match the whole path. I found this out when working on facebook/create-react-app#584. When using this configuration the modules were stubbed correctly:
Upon further investigation, I found out that this line in jest-resolve uses the same regex to replace the module name with the mapped name, and if the regex doesn't match the whole path, it doesn't get replaced correctly.
What is the expected behavior?
Expected to be able to use regexes like \\.css$ that only match the end of the path.
The text was updated successfully, but these errors were encountered:
This issue 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.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The
moduleNameMapper
configuration only works with regexes that match the whole path. I found this out when working on facebook/create-react-app#584. When using this configuration the modules were stubbed correctly:But changing it to following caused them to not be stubbed:
Upon further investigation, I found out that this line in
jest-resolve
uses the same regex to replace the module name with the mapped name, and if the regex doesn't match the whole path, it doesn't get replaced correctly.What is the expected behavior?
Expected to be able to use regexes like
\\.css$
that only match the end of the path.The text was updated successfully, but these errors were encountered: