-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Custom Jest transformations are applied after default transformations #8654
Closed
JereKuusela opened this issue
Mar 15, 2020
· 2 comments
· May be fixed by abhijit945/create-react-app#6, admmasters/create-react-app#9, xhad/create-react-app#14, pickworth/create-react-app#20 or rangle/create-react-app#21
Closed
Custom Jest transformations are applied after default transformations #8654
JereKuusela opened this issue
Mar 15, 2020
· 2 comments
· May be fixed by abhijit945/create-react-app#6, admmasters/create-react-app#9, xhad/create-react-app#14, pickworth/create-react-app#20 or rangle/create-react-app#21
Labels
Comments
This was referenced Jul 16, 2020
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
This was referenced Jan 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Custom Jest transformations are applied after default transformations.
Did you try recovering your dependencies?
Yes
npm --version: 6.14.2
Which terms did you search for in User Guide?
transform, jest
Environment
current version of create-react-app: 3.4.0
running from C:\Users*****\AppData\Roaming\npm-cache_npx\2056\node_modules\create-react-app
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Binaries:
Node: 12.2.0 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
Internet Explorer: 11.0.18362.1
npmPackages:
react: ^16.12.0 => 16.13.0 (16.2.0)
react-dom: ^16.12.0 => 16.13.0
react-scripts: 3.4.0 => 3.4.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
Expected behavior
Console should show contents of the text file.
Actual behavior
Console shows file name of the text file.
Source of the issue
The issue is caused in file createJestConfig.js:
This causes custom transfomers to be applied after default transfomers. This makes it impossible to apply more specific transformations because the more general transformation has a higher priority,
In this case:
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': resolve('config/jest/fileTransform.js')
prevents my "\.txt$": "jest-raw-loader" from working.
Possible fix
I would fix this by following change:
This would give higher priority to custom transformers while still allowing overriding default transformers.
But not 100% sure if this a bug in the first place (I'm not very familiar with Jest configuration).
The text was updated successfully, but these errors were encountered: