Open ArTiSTiX opened 4 years ago
I tried snapshotting only the atom component separately, with all variants found when included. Thing is, this test passes, and have no issue with order: test.js
test('should render multiple days without a problem', () => {
const { container } = render(
<>
<Day shadowed>10</Day>
<Day isSelected>11</Day>
<Day isStartEdge>12</Day>
<Day isInPath>13</Day>
<Day isEndEdge>14</Day>
<Day>15</Day>
<Day shadowed>16</Day>
<Day disabled>17</Day>
</>,
);
So why when including this component in a parent one, class order could differ when snapshotting ?
What could explain this class swap while all package versions are locked ?
The only difference i KNOW, is that CircleCi environment is a Linux 92ac78610905 4.15.0-1052-aws #54-Ubuntu SMP Tue Oct 1 15:43:26 UTC 2019 x86_64 Linux
while snapshots were written on MacOS Mojave / Catalina.
-- EDIT: the best solution I found :disappointed: :
const { CIRCLECI } = process.env;
const ignoreCircleCiTest = CIRCLECI === 'true' ? xit : test;
ignoreCircleCiTest('should render without a problem', () => { ... }
I don't think that's the best idea to skip tests in remote repo
Hope someone can help with it
In my case only names of classes changes. I'm running tests localy on Linux and remote in Linux container but have the same issue...
UPD.
In my case using styled(
I'm seeing what looks like the same issue.
I am creating snapshots on macOS, and running tests on Ubuntu using a GitHub action. The macOS snapshot contains className="testing c0"
but the GitHub action generates className="c0 testing"
. So maybe
I also had a className order issue before installing jest-styled-components
- I was hoping it would fix any className issues. Before installing it, macOS was generating className="testing sc-bdVaJa OXYu"
but the GitHub action was generating className="sc-bdVaJa OXYu testing"
. This suggests the bug is not with jest-styled-components
, but perhaps styled-components
itself.
I have this strange issue when execution snapshot testing of components in different environments (local). I have multiple environments which runs the same tests, and produce the same snapshots, but on CircleCI, one of the snapshots differs, only in the order of the generated classes.
I checked all the version, locked with
yarn.lock
:All environments are exactly the same and run with
BABEL_ENV=test jest --ci --maxWorkers=2
, i even cleared out dependencies cache of CircleCI to ensure we are locked toyarn.lock
.Here is the snapshot difference given by CI:
Looks like c12 and c13 are inverted, Local snapshotting presents a
.c13
class before.c12
, but CircleCI presents.c12
then.c13
with inverted logic.If i understand correctly, the classes are generated depending on the order of appearance/usage ? This component test ensures classes appear in the same order (DOM snapshot has no difference). I tried multiple solutions, like changing the style order, etc... it only changed the content of styles, not this ordering issue.
Here is the style responsible:
NOTE: code cleaned out of unnecessary data.
Any clue ?