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

Different Snapshot of styled-components #2796

Closed
derKoller opened this issue Oct 9, 2019 · 2 comments
Closed

Different Snapshot of styled-components #2796

derKoller opened this issue Oct 9, 2019 · 2 comments

Comments

@derKoller
Copy link

I have a strange situation with an enzyme.mount snapshot. We are 5 developers in our project. I am the only one with a Mac OS system. We are using styled-components in version 4.2.0 and enzyme in Version 3.9.2.

In my case the snapshots are not working. If I run a snapshot test with enzyme.mount, the snapshot has other values as my example states. The result differs only in styled-components.

The differences are:

IsStatic is false instead of true

-  "isStatic": true,
+  "isStatic": false,

usesTheme is listed and false
+ "usesTheme": false,

className in different order

-  className="c19 c9"
+  className="c9 c19"

all attributes in different order

-  "html": "<i class="sc-bdVaJa sc-hSdWYo sc-cMljjf fas fa-map-marker-alt eEduRX" font-size="20" color="#5FC7BF" cursor="pointer"></i>",
+  "html": "<i font-size="20" color="#5FC7BF" cursor="pointer" class="sc-bdVaJa sc-hSdWYo sc-cMljjf eEduRX fas fa-map-marker-alt"></i>",

I have no idea what I can do. I have tried other versions of different dependencies… but nothing seems to help.

i am using:

    "enzyme": "^3.9.0",
    "enzyme-adapter-react-16": "^1.14.0",
    "enzyme-to-json": "^3.3.5",
    "jest": "^24.9.0",
    "jest-styled-components": "^6.3.3",
@quantizor
Copy link
Contributor

One of you likely has a newer version of s-c installed. We changed how isStatic is set in non-production environments. If you update to latest v4 and update your snapshots it should stay constant.

@Chaoste
Copy link

Chaoste commented Nov 11, 2019

I was thinking I was using the same version on both machines but it's worth pointing out that sometimes you need to remove the node_modules and lock file and reinstall everything from scratch (as described in this answer on SO)

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