bruderstein / unexpected-react

Plugin for http://unexpected.js.org to enable testing the full React virtual DOM, and also the shallow renderer
http://bruderstein.github.io/unexpected-react
MIT License
187 stars 19 forks source link

Broken with React 16.9? #58

Closed jharris4 closed 4 years ago

jharris4 commented 5 years ago

Hi, I'm trying to refactor react-select v1.x to work with React 16.9, and the test suite for that version are using unexpected-react.

A few of the tests are failing, with output like:

UnexpectedError: 
expected null to contain
<div className="Select-multi-value-wrapper">
  <div><span className="Select-value-label">Yes</span></div>
  <div><span className="Select-value-label">No</span></div>
</div>

After digging into one of the failing tests with the node debugger, I traced the problem to the call to this function returning null: return RenderHook.findComponent(component);

So it seems like react-render-hook might not be working with React 16.9 ? If I remember correctly, this latest version of React shipped with a new dev tools API...

sunesimonsen commented 5 years ago

Sorry to hear that. This library is not well maintained, but I still hope that somebody will fix the problem. Most of the core unexpected devs has moved to unexpected-reaction.

How many test does react-select have, I might contribute a conversion to unexpected-reaction if the task isn't super large.

jharris4 commented 5 years ago

Thanks for the response! There were quite a few tests in react-select, and it's actually an old unmaintained fork, so I'd say not worth your time unless there's a trivial way to fix the react-render-hook package to get this package working again...

bruderstein commented 4 years ago

Just a quick update on this: I am actually looking into this, and updating the render hook to work with the latest react. It's not quick, but I have a vested interest in getting this working :), so it will happen.

bruderstein commented 4 years ago

Done! unexpected-react 6.0.0 works with React 16.9 and above (tested with 16.9 and current 16.12)

Sorry this took so long.

jharris4 commented 4 years ago

Awesome, thanks for looking into this!

I'll try it out the next time I tinker with the related tests.