Provide first-class support for CRA #90
Labels
bug
Something isn't working
documentation
Improvements or additions to documentation
enhancement
Enhancement to current features/ behaviors
feature request
Request a new feature
Describe the bug
There are several issues with CRA, all of them related to that we couldn't modify jest's config freely (see how CRA overrides config here https://github.com/facebook/create-react-app/blob/63bba07d584a769cfaf7699e0aab92ed99c3c57e/packages/react-scripts/scripts/utils/createJestConfig.js#L94-L107 ):
moduleNameMapper: { - '^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy', },
(Can we add a module, instead of
identity-obj-proxy
, we keep the original behavior?)cssTransform
like this:Preview won't have CSS, the reason is
"^.+\\.(css|scss|sass)$"
doesn't replace"^.+\\.css$": resolve('config/jest/cssTransform.js')
, so"^.+\\.css$": resolve('config/jest/cssTransform.js')
still take placeOne workaround to make both .css, .scss, .sass work is to configure like this:
To Reproduce
Expected behavior
Jest Preview should work with CRA out of the box
Others
We can find a way to override CRA config, like
jest.config.js
or usejest --config
. But CRA/ Jest might throw an warning/ error for having multiple Jest config. Reference: https://github.com/facebook/jest/blob/49322b6e7afa9a3ffa1bb1c3d12660bf2869a004/packages/jest-config/src/resolveConfigPath.ts#L142-L156Another idea: We provide a
cra-test
function for user to use instead of usingtest
from CRA directly?The text was updated successfully, but these errors were encountered: