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
PrettyFormatPluginError: Cannot delete property 'className' of #<Object> #2642
Labels
Comments
I've added such tests locally and they pass: You'd have to provide a full runnable repro case for me to investigate it any further. |
4 tasks
Hi, I managed to reproduce this consistently with a node passed in a render prop: (I'll try to find the cause and submit a real PR if I find the time 😅 ) |
jeremy-davis-sonarsource
added a commit
to jeremy-davis-sonarsource/emotion
that referenced
this issue
Jan 6, 2023
Forgot to mention here that I updated my PR to suggest a fix! |
jeremy-davis-sonarsource
added a commit
to jeremy-davis-sonarsource/emotion
that referenced
this issue
Mar 23, 2023
jeremy-davis-sonarsource
added a commit
to jeremy-davis-sonarsource/emotion
that referenced
this issue
Aug 14, 2023
@Andarist - are you able to get this merged? |
jeremy-davis-sonarsource
added a commit
to jeremy-davis-sonarsource/emotion
that referenced
this issue
Mar 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current behavior:
Components that have a static
defaultProps
(withclassName
set to''
) cannot be serialized using the@emotion/jest/enzyme-serializer
(and probably also with@emotion/jest/serializer
as it's using shared logic).The tests are throwing:
Looks like t's failing on this line:
https://github.com/emotion-js/emotion/blob/main/packages/jest/src/create-serializer.js#L174
To reproduce:
Define a component with defaultProps. Use either the syntax:
or
then prepare a test where this component is used and serialized to a snapshot:
Expected behavior:
Test should run and either fail if snapshots are not matching, or succeed if they are matching.
Actual behavior:
The test fails on the serialization process.
Environment information:
react
version:^17.0.2
@emotion/css
version:11.5.0
@emotion/jest
version:11.5.0
@emotion/react
version:11.5.0
@emotion/styled
version:11.3.0
jest
version:^27.5.1
ts-jest
version:^27.1.3
babel-jest
version:^27.5.1
Jest config:
The text was updated successfully, but these errors were encountered: