Skip to content

v1.4.0

Compare
Choose a tag to compare
@adriantoine adriantoine released this 06 Dec 17:53

<a name"1.4.0">

1.4.0 (2016-12-06)

One function to rule them all

You don't need shallowToJson, mountToJson and renderToJson anymore, just use one toJson function:

import toJson from 'enzyme-to-json';

the wrapper type is now detected internally using instanceof.

Serializer

Inspired by jest-serializer-enzyme, you can now use a jest snapshot serializer with the output of enzyme-to-json.

Add this to your jest configuration:

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

Then you can have an Enzyme serialization without having to import or use any of the toJson functions! And it has the same output as the good old xxxxToJson helpers.

More information about the serializer in the README.md.