Jest snapshots failing due to unique hash
nialloc9 opened this issue · 8 comments
Yes, using props.
You can turn off hashing with uniquifyIDs
or pass your own hash with uniquifyIDs
Thank you for your reply. Yes this was actually what I did earlier today to fix this and I can confirm it will but I was kind of hoping that there might be another solution out there that didn't involve changing the application code to make the tests work. Even though it doesn't effect how the application runs and works perfectly well.
I did update the minor version, that requires you to update it manually.
But I failed to mention the unique hash changes in the 0.7.0 release notes, sorry.
Thats cool. Awesome job by the way.
@gilbarbara this still seems to be adding a uniqueHash prop to my components :( . is it possible it isn't fixed yet?
Here is a screenshot to show you jest is still failing even with the prop set to false.
Also as a workaround I'm using enzymes 'shallow' instead of 'mount' to create the snapshot. However, Ideally I'd like to turn mount back on.
Perhaps we can learn something from https://github.com/styled-components/jest-styled-components. Styled components assign random hashes to the elements and this plugin allows jest snapshots to continue to pass.
@mackbrowne fixed in 7f8dd86
published as 0.7.5
@gilbarbara great work. Thank you.
@gilbarbara thanks upgrading to 075 fixed it!