Add support for customizing Jest config with react-app-rewired#2396
Add support for customizing Jest config with react-app-rewired#2396acostadelivra wants to merge 3 commits intomicrosoft:mainfrom
Conversation
|
Hi! I'm trying to better understand your scenario. Is this just a convenient way of avoiding "npx react-app-rewired test" or is it required for what you're doing? |
|
We're trying to get our test results in Test Explorer rather than through the command line, so in that sense it's required. There seems to be no way to override the react-scripts config in the current TestAdapter code as far as I can tell. I completely understand the security concern though, and I think it can be worked around. react-app-rewired just loads a 'config-overrides.js' file in the project root (similar to jest.config.js) and uses it to transform the react-scripts output. Let me know if this sounds like a better plan and I'll go ahead implement it. |
|
Sorry for the long delay, I lost track of this PR. I've updated it so that react-app-rewired is never directly executed. Instead just the user supplied config-overrides script is used. This should be equivalent and less invasive. |
Loads the react-app-rewired library (if present) in order to customize the Jest config provided by react-scripts. This allows customizing the config further than what react-scripts normally allows, without ejecting.
This is normally accomplished via the command line like "npx react-app-rewired test". I think requiring the overrides/jest.js file is the most appropriate way to load it directly.