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

Revert Jest moduleNameMapper regex back to a whitelist #1149

Merged
merged 1 commit into from
Dec 4, 2016

Conversation

fson
Copy link
Contributor

@fson fson commented Dec 4, 2016

Jest matches moduleNameMapper regexes with module names, not the full file path, so the negative lookahead doesn’t work for filtering out JS files, because they can be imported without the extension. So paths like lodash.assign and ../utils/range were mislabeled as resources with unknown file extensions because they have a dot in the name.

As a stopgap measure, revert the moduleNameMapper regex added in #1077.

This will fix issues #1145 and #1147. However, since the behaviour will now differ for obscure file extensions not listed in the whitelist, we should try to find a way to support the same behaviour as we have for webpack loaders (map any unknown file type mapped to a stub).

Jest matches moduleNameMapper regexes with module names, not the full
file path, so the negative lookahead doesn’t work for filtering out
JS files, because they can be imported without the extension. So paths
like `lodash.assign` and `../utils/range` were mislabeled as resources
with unknown file extensions because they have a dot in the name.

As a stopgap measure, revert the moduleNameMapper regex added in facebook#1077.
@fson fson merged commit 715de0d into facebook:master Dec 4, 2016
@fson fson deleted the fix-jest-stubs branch December 4, 2016 08:58
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this pull request Jan 23, 2017
Jest matches moduleNameMapper regexes with module names, not the full
file path, so the negative lookahead doesn’t work for filtering out
JS files, because they can be imported without the extension. So paths
like `lodash.assign` and `../utils/range` were mislabeled as resources
with unknown file extensions because they have a dot in the name.

As a stopgap measure, revert the moduleNameMapper regex added in facebook#1077.
randycoulman pushed a commit to CodingZeal/create-react-app that referenced this pull request May 8, 2017
Jest matches moduleNameMapper regexes with module names, not the full
file path, so the negative lookahead doesn’t work for filtering out
JS files, because they can be imported without the extension. So paths
like `lodash.assign` and `../utils/range` were mislabeled as resources
with unknown file extensions because they have a dot in the name.

As a stopgap measure, revert the moduleNameMapper regex added in facebook#1077.
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
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.

2 participants