-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
toMatchInlineSnapshot breaks when testing JSX syntax on a fresh CRA5 project #11928
Comments
This issue seems to be related to this Jest issue jestjs/jest#11730 |
It looks like a viable workaround is to add a
I define it only for the test environment otherwise IDEs such as VS Code will show an error coming from babel-preset-react-app that complains about an undefined |
There is a known Jest bug documented here: facebook/create-react-app#11928 regarding an "experimental feature jsx" that is not supported. Apply the workaround here, as well as set the Jest test environment to "jsdom" for React Testing Library to properly run.
try removing all .jsx inside extenstion
}, |
Describe the bug
Running the above test on a fresh Create React App 5.x and asking Jest to update the snapshot makes the process fail with the following error:
Everything works fine with
toMatchSnapshot
Did you try recovering your dependencies?
The project has been freshly started from scratch.
Which terms did you search for in User Guide?
toMatchInlineSnapshot
Environment
Steps to reproduce
yarn test
Expected behavior
The snapshot should be updated.
Actual behavior
See error above.
Reproducible demo
https://github.com/FezVrasta/cra5-tomatchinlinesnapshot-repro
The text was updated successfully, but these errors were encountered: