enzyme: Upgrading from enzyme-adapter-react-16@1.15.1 -> 1.15.2 breaks connected component tests

Current behavior

When I upgrade from 1.15.1 of enzyme-adapter-react-16 to version 1.15.2, I am running into JSX comparison test failures with connected components.

Ex.

  const wrapper = shallow(<SomeComponent />).get(0);
  expect(wrapper).toEqualJSX(
    <ConnectedRouter history={history}>
          ...childrenHere
    </ConnectedRouter>
  )

// FAILURE
- <ConnectFunction
+ <Connect(ConnectedRouterWithContext)

Note: toEqualJSX -> https://www.npmjs.com/package/jasmine-expect-jsx is a simple wrapper around react-element-to-jsx-string -> https://github.com/algolia/react-element-to-jsx-string and turns a react element into a JSX string.

Expected behavior

Expect tests to still pass without change after bumping minor version

Your environment

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.11.0
react 16.13.1
react-dom 16.13.1
react-test-renderer 16.13.1
adapter (below) 1.15.2

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @ljharb. I made #2408 and I think that covers it though it was hard to find the right spot for the unit test.