Closed wytrych closed 6 years ago
Hi @wytrych, I'll have a look at your bug as soon as I can.
Thank you!
Ok so the main isssue is actually not the array but passing a fragment as a prop, this is enough to reproduce the issue:
it('should not output UNDEFINED nodes', () => {
const component = shallow(
<div><TestComponent options={<React.Fragment>Test</React.Fragment>} /></div>
);
expect(toJson(component)).toMatchSnapshot();
});
We support Fragment as children but not (yet) as props.
Verified that https://github.com/facebook/jest/pull/5816 fixes the issue:
That's really cool, thanks for taking it further @adriantoine
No problem, thanks @rickhanlonii for the fix!
I guess we still need to wait for a new version of Jest to be released and then the package version updated here?
@wytrych you don't need to wait for a new version of enzyme-to-json
just get the next Jest release which includes @rickhanlonii's fix.
Ok thanks!
Test case:
Snapshot: