Jest 23 --config breaks create-react-app on Windows
See original GitHub issueI am trying to use Jest 23 in create-react-app@next https://github.com/facebook/create-react-app/pull/4555
In particular I’ve found windows config to break after the upgrade.
The specific part of config being generated is https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/scripts/utils/createJestConfig.js#L47
In Jest 22.4.3 the regex is [\\\\\\\\\\\\]node_modules[\\\\\\\\\\\\].+\.(js|jsx|mjs)$|^.+\.module\.(css|sass|scss)$/
(12 slashes) in jest-runtime
In Jest 23 the error is Invalid regular expression: /[\\\\\]node_modules[\\\\\].+\.(js|jsx|mjs)$|^.+\.module\.(css|sass|scss)$/
Does not repo on other platforms.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:19 (2 by maintainers)
Top Results From Across the Web
Jest from create-react-app not running on Windows
create -react-app is CLI that generates react-scripts pre-configured setup that includes Webpack and Jest configuration, among other things.
Read more >Troubleshooting - Jest
If you are using Facebook's create-react-app , you can debug your Jest tests with the following configuration: { "version": "0.2.0",
Read more >First class support for Create React App - Jest Preview
Currently, there is no way to customize CRA's jest.config.js file easily. So, Jest Preview bundles a few CLIs to make integrating Jest Preview ......
Read more >Electron and React integration done right - Patrick Passarella
First, create a folder, outside of the src folder, named electron , and a main.js file inside it. Change the main property in...
Read more >Introducing the New JSX Transform – React Blog
Together with the React 17 release, we've wanted to make a few improvements to the JSX transform, but we didn't want to break...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Speculating…
jest-config/build/index.js::readConfig() calls normalize() on incoming option values and defaults, including
transformIgnorePatterns
.When normalize() sees
options.transformIgnorePatterns: "[/\\]node_modules[/\\].+\.(js|jsx|mjs)$"
it converts that tovalue: "[\\\\\]node_modules[\\\\\].+\.(js|jsx|mjs)$"
Note that really is 5 back slashes, 2 each from each incoming back slash and 1 from the forward slash. An odd number of back slashes produces much unhappiness for a later
new RegExp()
.normalize()
usesnormalizeUnmockedModulePathPatterns()
which uses ‘jest-regex-util’. Checking the results returned by that module’s code finds:so path separators are okay unless they happen to have char class delimiters around them. Perhaps the wrong routine is being used? Or rather, that one routine is being called for incompatible uses.
Oh, the rules wrt to ‘[’ and ‘]’ got changed by edd95fc4df8d6c539bfe21881e922fa75f9c5b69 and #5941
You probably do want separate routines…
I have downgraded jest and jest-cli from v 23.1.0 to v 22.4.4.Now it’s working fine.This error is only on windows platform.