Jest snapshots work locally but consistently fail on Travis CI
I would make sure that I am using the exact same version on both locally and on CI. Try pinning jest
and babel-jest
to a specific version:
"babel-jest": "=19.0.0","jest": "=19.0.2",
Maybe I would do the same with all the dependencies! Then remove node_modules/
from your machine, run the tests (update snapshots if necessary) and push.
Ps. I would also try to empty the caches on travis: https://travis-ci.com/USERNAME/REPOSITORY_NAME/caches
.
In my case, I had a mismatch between the node version in the build system vs local.