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

Support jsx-runtime for jest babel transform #216

Merged
merged 1 commit into from
Nov 30, 2020

Conversation

wanglam
Copy link
Contributor

@wanglam wanglam commented Nov 24, 2020

This is a part of work about #205 .
I upgrade react-scripts to 4.0.1 version, and everything fine with npm run start / npm run build.
But when I run npm run test, the error occurs like this:

image

Here is the example project: craco-jsx-runtime-jest-bug, will get the same error.

Then I go to the react-scripts/config/jest/babelTransform.js, find we need runtime option to support jsx-runtime. So I create this pull request.

For old version babel-preset-react-app(I have checked this file), it's ok to pass same options, I just ignore version check.

@patricklafrance
Copy link
Contributor

Hi @wanglam

Thanks for the PR :)

Did you do anything else to make Jest works with react-script 4.0.1 and React 17?

I get the following error:

image

Thank you,

Patrick

@wanglam
Copy link
Contributor Author

wanglam commented Nov 30, 2020

Hi @patricklafrance

No, I didn't do anything else to make Jest work with react-scripts 4.0.1 and React 17.

I confirmed If you create a new project based CRA(version 4.0.1) and run npm run test. Everything work fine, no error will be found.

Would you like to upload your project? Maybe we can check it together.

Lin

@patricklafrance
Copy link
Contributor

@wanglam I was running yarn jest instead of yarn test :(

@patricklafrance patricklafrance merged commit 2479b9e into dilanx:master Nov 30, 2020
@patricklafrance
Copy link
Contributor

Works fine, thanks for the PR :)

@patricklafrance
Copy link
Contributor

Released in https://www.npmjs.com/package/@craco/craco/v/5.9.0

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

Successfully merging this pull request may close these issues.

None yet

2 participants