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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 3.0 (Enzyme 3 and React 16 compatibility) #67
Comments
Beta 2 has been published with most of the items from the list addressed. |
The output mapping feature I'm working on is working in the way that you can pass a map function in the options and this function will take the JSON as only parameter and can return a modified version of this JSON object. For example: const shallowed = shallow(
<div randomlyGeneratedKey={Date.now()} className="wrapper">
<strong randomlyGeneratedKey={Date.now()}>Hello!</strong>
<strong className="strong2">Hello 2</strong>
</div>,
);
expect(
shallowToJson(shallowed, {
map: json => ({
...json,
props: omit(json.props, 'randomlyGeneratedKey'),
}),
}),
).toMatchSnapshot(); Here
and if you want to remove all attributes: expect(
shallowToJson(shallowed, {
map: json => ({
...json,
props: {},
}),
}),
).toMatchSnapshot(); outputs:
You can also change the children of a component, return |
The map feature has now been released in |
@adriantoine hello! Looks like Enzyme 3 is released: https://github.com/airbnb/enzyme/releases/tag/enzyme%403.0.0 |
React 16 is out as well |
That's nice, I'll arrange a release of |
Thanks for the hard work @adriantoine !!! |
Thanks for your messages! |
I was working on #63 and eventually decided to go for a slightly larger refactor of the library. It was started as simple quickly-made library and I was never expecting nearly 500 stars, so I think that it now needs a bit of polish. 馃榿
Here is a roadmap of everything I expect to be in the next major 3.0 release:
Roadmap
mount
wrappermountToShallowJson
andmountToDeepJson
and use options with{mode: 'shallow'|'deep'|'normal'}
insteadWarning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers. http://fb.me/react-polyfills
coming with React 16Bugs
None yet
Known potential breaking changes
Components returning
null
or any falsy value are now rendered as an empty string in snapshots instead ofnull
Shallow wrapper are now outputting
undefined
props:This use case won't be supported anymore, it seems incorrect anyway to pass
this
as a prop and I can see no usage of this in thereact-bootstrap
documentation anywayThis use case won't be supported either as it doesn't seem to be supported by Enzyme either, you will just have to use their
simulate
helper to do thatmountToShallowJson
andmountToDeepJson
are replaced by amode
option inmountToJson
:All those changes will be made in the
enzyme3
branch, I might create individual issues for some of those to track progress. I will also need a lot of testing with Enzyme 3 and React 16.If anyone feels like working on any of the tasks above, please let me know! 馃榿
The first beta version has been released already 馃帀, you can test it with this command:
npm install --save-dev enzyme-to-json@next
The text was updated successfully, but these errors were encountered: