rogeliog / jest-serializer-enzyme

A snapshot serializer for Jest+Enzyme.
68 stars 8 forks source link

Snapshots tests fail for jest 20 with jest-serializer-enzyme #13

Open ismay opened 7 years ago

ismay commented 7 years ago

When upgrading to jest 20 the snapshot tests I'm running with shallow rendering fail because the results aren't being serialized anymore:

According to the jest docs and blog there shouldn't be any breaking changes that affect this:

But still they're failing (it's rendering the shallow wrapper directly, instead of the serialized result), while tests that aren't using enzyme pass. I was wondering if there is anything that needs to be changed when using this library with jest 20.

ismay commented 7 years ago

Using ReactShallowRenderer seems to fix it though. So I'm not sure what's going on here. Seems to me that it's the serialization, but I could be wrong.

ismay commented 7 years ago

I think the problem is this: https://github.com/facebook/jest/issues/3535. My config is:


{
  "snapshotSerializers": [
    "<rootDir>/node_modules/jest-serializer-enzyme"
  ]
}

And apparently rootDir isn't being resolved anymore.

mAiNiNfEcTiOn commented 7 years ago

@ismay yup, you should just have:

{
  "snapshotSerializers": [
    "jest-serializer-enzyme"
  ]
}