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

Test fails, says there is a difference in the snapshot, but actually there is no difference. #396

Open
adbutterfield opened this issue Dec 17, 2021 · 0 comments

Comments

@adbutterfield
Copy link

HI, I have a strange issue (or maybe it's because I'm doing something strange?).

First of all, I'm not sure if this is an issue with this repo, or something in the tooling chain. Please let me know if you think it's not an issue with this wonderful package.

I have a component library, and have just implemented a very paranoid testing strategy, where I run my tests on the build before publishing a new version. I have a bunch of snapshot tests, and for testing the build I simply re-use the snapshots for the tests I run on the non-built components. Everything works great except for one test for one component.

I nailed the issue down to this line here: https://github.com/adbutterfield/jest-snapshot-issue/blob/3ce96e1bc0d228f0959341b4193444791cb7dacc/src/Loading/Loading.styles.ts#L29

Something about the animation is making it fail. If I comment out that line, everything works fine.

Reproduction repo:
https://github.com/adbutterfield/jest-snapshot-issue

Steps to reproduce:

  • clone repo
  • npm install
  • npm run build && npm run test:build

Note: in the reproduction repo, the name for the animation is different when you run test:build, but I actually don't get the issue in my other repo (my actual component library repo).

If you run npm run test:build -- -u it will update the snapshot and you can see the diff in git. It will only be the animation name in the diff, and not everything that jest says is different between the snapshots.

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

1 participant