-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Snapshot tests failing for React 19 #15402
Comments
As a hotfix, you can add overrides to your package.json
The issue is related to react changing the This is a bit tricky for Jest as updating the Maybe updating typeof val === 'object' &&
val != null &&
(
ReactIs.isElement(val) ||
val.$$typeof === Symbol.for('react.element') // Compatibility with react <19
) will solve the issue? But I am not sure if there are more use-cases, that can break. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Leaving a comment to remove stale label |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Leaving a comment to remove stale label |
I had another related issue when the component to be serialized received a React Element as a prop. It tried to serialize it with @Filipoliko's comment did the trick. For other {
"resolutions": {
"**/pretty-format/react-is": "19.0.0"
}
} |
Some of our legacy dependencies are holding back the version of react-is we have installed. It is used in prop-types and pretty-format which is used in the few snapshot tests we have. Pins to the same version of react we're using. Will need to be upgraded to 19. Otherwise causes the issue seen in jestjs/jest#15402 part of getsentry/frontend-tsc#68
Version
29.7.0
Steps to reproduce
Clone repo:
git clone https://github.com/remarkablemark/html-react-parser.git cd html-react-parser git checkout build/package
Install deps:
Run tests:
npm test
See remarkablemark/html-react-parser#1629 (comment)
Expected behavior
Snapshot tests without issues
Actual behavior
Snapshot tests failing for React 19:
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: