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

Jest 23.1 has regex issue on Windows #669

Closed
benhamlin opened this issue Jun 18, 2018 · 5 comments
Closed

Jest 23.1 has regex issue on Windows #669

benhamlin opened this issue Jun 18, 2018 · 5 comments

Comments

@benhamlin
Copy link
Contributor

Regretfully I missed this somehow in testing the Jest 23.1 bump, but Jest 23 has issues with
a specific regex that's part of CRA: jestjs/jest#6385.

Razzle has the same regex:

transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$'],

Seems like there are 3 options here:

  1. Roll back Jest to 22.4, which has minor, but tolerable issues.
  2. Make a change in Razzle to update that regex to something Jest doesn't barf on
  3. Wait for Jest to fix their transform.
@benhamlin
Copy link
Contributor Author

benhamlin commented Jul 6, 2018

More fun in windows path normalization land!

The good news is that the regex issue was fixed, and no longer causes jest to puke.

The bad news is that it seems there is another issue in 23.3 (jestjs/jest#6576) where the testMatch paths provided by razzle, i.e. <rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}, is finding no tests. This repros even on a brand new razzle app. It appears to be related to <rootDir>, as replacing that with ** works fine.

Is there a reason default razzle testMatch includes <rootDir>/src ?

In the meantime this one is easy to work around by overriding testMatch in package.json.

@jaredpalmer
Copy link
Owner

Compat with CRA

@katiawheeler
Copy link

I am having this issue as well with the default regex not finding tests.

@benhamlin
Copy link
Contributor Author

benhamlin commented Jul 9, 2018

The exact workaround until Jest fixes it (and from all appearances the fix is coming soon), is to add this to your package.json:

 "jest": {
    "testMatch": [
      "**/__tests__/**/*.{js,jsx,mjs}",
      "**/?(*.)(spec|test).{js,jsx,mjs}"
    ]
  }

Works On My Box™

@benhamlin
Copy link
Contributor Author

Jest rolled back their version of micromatch, issue is fixed in Jest 23.4. Confirmed that fresh razzle app is finding tests again without any overriding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants