Jest/Enzyme ShallowWrapper is empty when creating Snapshot

There shouldn't be a need of reverting version. Following the official DOC

You need to add this to your Jest configuration:

"snapshotSerializers": ["enzyme-to-json/serializer"]

clue: could be as easy as add it to your package.json, like:

{
  "name": "my-project",
  "jest": {
    "snapshotSerializers": ["enzyme-to-json/serializer"]
  }
}

Sorry if it wasn't the answer. I just saw no-one told it here and it must help other losts like me few minutes ago.


You need to use jest-enzyme like:

https://github.com/airbnb/enzyme/issues/1533#issuecomment-479591007


For jest v24 you need to use snapshot serializer like https://github.com/adriantoine/enzyme-to-json

source: https://github.com/facebook/jest/issues/7802


I faced the same issue after updating to [email protected] I have reverted to the previous version [email protected] for the time being till i figure out what has changed. If you find what has changed, do post it here.