Enzyme: [email protected] changed the behavior of isMemo function, which cause enzyme selector fail.

Created on 27 Nov 2019  路  9Comments  路  Source: enzymejs/enzyme

Current behavior

https://codesandbox.io/s/gracious-sun-qih2n broken
https://codesandbox.io/s/agitated-firefly-ows1l working

Expected behavior

console.log("Icon is icon?:", mount().is(EditIcon)); // true

Your environment

React + Enzyme

Root cause

Please check in detail here https://github.com/facebook/react/pull/17278

Proposal:

  1. fix the is function call to isMemo to take component.type instead of component itself.
  2. pin the dependency of react-is to 16.11.0

API

  • [ ] shallow
  • [x] mount
  • [ ] render

Version

| library | version
| ------------------- | -------
| enzyme | 3.10.0
| react | 16.12.0
| react-dom |
| react-test-renderer |
| adapter (below) | 15.1

Adapter

  • [x] 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 ( )

Related issue https://github.com/facebook/react/issues/17457
Related issue https://github.com/facebook/react/pull/17278

All 9 comments

Yes, this is blocking #2292.

If you think you have a fix that's not pinning to 16.11, please link me to a branch and I'll pull in the commit :-)

If you think you have a fix that's _not_ pinning to 16.11, please link me to a branch and I'll pull in the commit :-)

I created #2298 , please review it :) .

Thanks; i was hoping for a branch instead of a second PR, but I鈥檒l take a look.

I closed PR #2298 and created #2300 . Please check it again.

Similarly, now there鈥檚 a 3rd PR where i wanted only 1 :-) I鈥檒l take a look but please do not open any additional PRs for this; reuse one of the existing ones.

Thanks about your reply, I just want to make clean my PR. ^^

Understood - but that's what force push is for :-) now the repo is less clean ;-)

Ok, I got it. But can you help me consider the latest PR? It has strange things, I have a comment looking forward to hearing from you.

Fixed in #2300.

Was this page helpful?
0 / 5 - 0 ratings