Closed kawikadkekahuna closed 6 years ago
I'm not sure what's going on either. Sorry :-/
Feel free to dig further! Good luck!
I think the issue might have something to do with what NODE_ENV
is set prior to snapshot creation.
Creating snapshots with no NODE_ENV
defined causes snapshots to be generated with
[data-glamor-0]:hover
I was able to resolve the issue by setting the NODE_ENV
to development, and then updating my snapshots.
I'm not sure if this is still a jest-glamor-react
specific issue or if it's more of a Jest Issue
Would a possible solution be to default the NODE_ENV to be development if none is currently set? Unfortunately, I won't have time to dive into the codebase until the weekend so I'm not sure if this is even a feasible answer.
Hmmm... I think that the default is development
. Things are only different with glamor
when the NODE_ENV is explicitly set to production
...
+1. Also having this issue and setting NODE_ENV doesn't seem to help.
What's up with the data-simulate
prefix? Any idea for where in the code this is being inserted? It's also interesting this doesn't seem to show up in this repo's src/__snapshots__
.
Try upgrading to the latest version (v4). Your snapshots will need updating. Then see if that fixes your CI issues.
Still having the same problem of inconsistent snapshots, and this is on the latest version (v4.2.1). The issue appears whenever I pass any state-based styling to my components, e.g.:
<div className={glamor.css(":focus": { background: "#ACF" })}>
Snapshot:
.css-1:focus,
[data-css-1]:focus {
background: #ACF;
}
Test failure output:
.css-1:focus,
- [data-css-1]:focus {
+ [data-css-1]:focus,
+ .css-1[data-simulate-focus],
+ [data-css-1][data-simulate-focus] {
background: #ACF;
}
I realize this description isn't super helpful. I'll try to provide more detail but I think this issue should be re-opened in the meantime.
That appears to be because when you took the second snapshot you were running with simulation enabled it something.... Maybe a different certain of glamor or something. Either way that's not related to this original issue and it's very unlikely an issue with this project, but rather your glamor setup.
jest-glamor-react
version: 3.2.2node
version: 8.0npm
(oryarn
) version: Yarn: 0.27.5Relevant code or config
What you did: Created snapshots locally, and ran build on CircleCI
What happened:
Reproduction repository:
Problem description:
What seems to be happening is that on when the test run on CircleCI, it expects
, though when running tests locally they generate the snapshot with
Suggested solution: Still fuzzy on what exactly is happening