Enzyme: ShallowWrapper instance() method always returns null since 1.15.3

Created on 13 Aug 2020  路  11Comments  路  Source: enzymejs/enzyme

Looks like this change broke the .instance() method on a shallow() rendered component for us when the root component is a React.Suspense. Verified to be working correctly in [email protected].

const wrapper = shallow(<ClassComponentWithReactSuspense />);
wrapper.instance(); // Always null

Any ideas?


It does seem to work correctly when using mount() though.

_Originally posted by @cascornelissen in https://github.com/enzymejs/enzyme/pull/2328#issuecomment-673513981_

shallow bug

Most helpful comment

Thanks for the release, it does indeed fix it on our projects. Thanks to both of you once more!

All 11 comments

I have the same issue as well!

I have the same problem, too.

Tagging @ljharb and @lamhieu-vk to make sure they're aware multiple people are running into this.

Sorry for the late reply. I will debug, report, and fix it soon!

@lamhieu-vk, I had a notification about a reply on this thread asking for repro repo but since that message is not visible here I guess you鈥檝e found the issue and don鈥檛 need a repro anymore?

@cascornelissen I created repro repo for this bug

I created a pull request for this issue!

@ljharb, sorry to tag you but are there any plans for a new patch release? We'd really like to get this fixed in our projects. 馃槄

Also, thanks for your time working on OSS! 鉂わ笍

v1.15.4 is released.

@cascornelissen please verify the new version and confirm here 馃槈

Thanks for the release, it does indeed fix it on our projects. Thanks to both of you once more!

Was this page helpful?
0 / 5 - 0 ratings