JavaScript: Upgrading mobx-react from 4.0.4 to 4.4.3 (with Enzyme)

I just upgraded mobx-react from 4.0.4 to 4.4.3. In theory, this should not have required any code changes. However, starting in mobx-react 4.1.2, there was something that tickled what I'm guessing is a hidden bug in Enzyme 3.3.0. We had a test that would purposely throw an exception in the render method of a React component. The test was written using shallow. Even once I had gotten the test to pass in mobx-react 4.1.2, it was somehow poisoning something unknown which caused about 0.5% of my other tests to fail. It was perfectly reproducible if I ran all the tests, but running any of them individually would not fail. It was quite baffling. My buddy Kevin figured out that moving from shallow to mount fixed the issue, inexplicably. It's a workaround, but we'll have to just live with it since I have no idea how to find the bug in Enzyme. Note, we're using React 15.6.2 and MobX 2.7.0.

Comments