question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@emotion/jest: Unstable order over different systems (docker vs native)

See original GitHub issue

Current behavior:

The order of interactive styles like :hover, :focus etc. is not stable in some cases. They are “jumping” around the “main class”. If multiple interactive styles exists they also mixing up themselves (e.g in some cases :hover is before :focus and in some it comes after).

The problem seems to occur only on docker vs native execution. As i get the same (stable) order on two different macs, running it on two different docker i also get the same (stable) order, but the order differ from the mac ones.

The screenshot shows the diff between running native (origin) and running on docker (the changes) after: Bildschirmfoto 2020-12-08 um 07 01 47

To reproduce:

  1. Create a component like a button and add some styles including :hover, :focus and :disabled to it.
  2. Create a jest test for using toMatchSnapshot
  3. Run the test native with npm
  4. Run the test with docker

Expected behavior:

The order of emotion styles should be the same independently from the environment it running on.

Environment information:

  • react version: 16.14.0
  • @emotion/jest version: 11.1.0
  • @testing-library/react version: 11.2.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Andaristcommented, Dec 8, 2021

@thisismana could you create a new issue about this? one thing that I would check on your end is if you are creating a cache per SSR request - if not that is the first thing to be fixed.

0reactions
bobaaaaacommented, Dec 9, 2021

It’s mentioned here: https://emotion.sh/docs/ssr#extractcritical . If you think there is a better place to highlight this - let us know. Unless your problem was not related to extractCritical?

Ah, I see. I guess this is ok. The mix of emotion and nextjs is sometimes hard to find the “best” solution. Even the nextjs-examples look a bit different in our case. But that’s a different story.

Just to confirm, were you able to resolve your problem using an Emotion cache per SSR request?

Yes. Thank you very much for your help. ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker frequently asked questions (FAQ)
You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM...
Read more >
7 Cases When You Should Not Use Docker - freeCodeCamp
When you are working on a piece of code in. ... If the wrong process is killed (including the Docker itself), the system...
Read more >
Docker on Mac - how to speed it up? | Accesto Blog
I was trying to separate work from after-work activities by using two operating systems, switching from one to another based on what I ......
Read more >
Using Docker Containers in IoT Devices - JFrog Connect
Single Board Computers (SBC) and System On Module(SOM) prices can be ... the native choice will be to give up on running Docker...
Read more >
Kubernetes Vs Docker - Sumo Logic
The code that worked perfectly on their machine doesn't work in production. The reasons for this are varied; different operating system, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found