Enzyme: Enzyme mount(): TypeError: Cannot read property 'rendered' of null

Created on 3 Oct 2017  Â·  11Comments  Â·  Source: enzymejs/enzyme

Similar problem as https://github.com/airbnb/enzyme/issues/1195

This is possibly a problem with https://github.com/Root-App/react-native-mock-render~~

TypeError: Cannot read property 'rendered' of null

      at Object.getNode (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:233:69)
      at new ReactWrapper (node_modules/enzyme/build/ReactWrapper.js:100:33)
      at mount (node_modules/enzyme/build/mount.js:19:10)
      at createTestApp (test/testHelper.js:20:27)
      at Object._callee$ (test/container-component/container.test.js:13:35)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:63:29)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:337:12)
      at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:96:13)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:63:29)
      at invoke (node_modules/regenerator-runtime/runtime.js:139:12)

My versions:

[email protected]
[email protected]
[email protected]
[email protected]

[email protected]
[email protected]
[email protected]

My test-code which produces the problem:
https://gist.github.com/Keksike/8afd4787f80c08e4e6d36c24a7886510

bug package 16

Most helpful comment

Make sure that you have enzyme-adapter-react-16 🙂

All 11 comments

Happens without react-native as well

I create a super basic test repo that shows this failing https://github.com/eddiemonge/enzyme-3-simple-test

Ran into this issue and did some debugging myself. Enzyme relies on the instance._reactInternalFiber property which did not exist until a later version of React. This did not work for me on react-native version 0.49.3 (the latest version at the moment) which uses react 16.0.0-beta.5. Updating to [email protected] fixed this issue.

Sounds like we need to up the peer dep on the react 16 adapter to a later version; @michaelgmcd, do you know which exact react 16 version added that property?

I've only briefly looked into this, but it looks like this commit made the change and it was released in react 16.0.0-rc.1 according to this release candidate issue

ok - we should lift the peer dep to that.

Is anyone else getting this error when trying to launch Enzyme setupTests.js: TypeError: Cannot read property 'ReactCurrentOwner' of undefined

@patrickford I got that error when I was using this adapter but was actually still pulling in React 15.X instead of 16.X

Thanks. We eventually figured that out. It was a project started a while back and was still on 15.x.


From: Andrew Jenkins notifications@github.com
Sent: Friday, February 23, 2018 8:19 AM
To: airbnb/enzyme
Cc: Patrick Ford; Mention
Subject: Re: [airbnb/enzyme] Enzyme mount(): TypeError: Cannot read property 'rendered' of null (#1217)

@patrickfordhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpatrickford&data=02%7C01%7C%7C854279fbba79405f7f5d08d57ad93da4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549995809031267&sdata=OYzX6so%2BWrZeON4HblyR6%2BT6Q8yPCV%2B2hFGNjvHHZx4%3D&reserved=0 I got that error when I was using this adapter but was actually still pulling in React 15.X instead of 16.X

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fairbnb%2Fenzyme%2Fissues%2F1217%23issuecomment-368057499&data=02%7C01%7C%7C854279fbba79405f7f5d08d57ad93da4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549995809031267&sdata=Rp6HJK47fuigpzXQHzs%2Bf79izlNEJ4z8Msj%2B0AACc5M%3D&reserved=0, or mute the threadhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAsUdm30NLb8K5fxI49MK8TnJSK6Bp7Vks5tXuURgaJpZM4PrrwO&data=02%7C01%7C%7C854279fbba79405f7f5d08d57ad93da4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549995809031267&sdata=PG3EohnSNW17nmxiTh9Ioehy1adf%2BZrcOx%2BGqdaqyZo%3D&reserved=0.

Make sure that you have enzyme-adapter-react-16 🙂

This seems closeable; please file a new issue if there's still problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dschinkel picture dschinkel  Â·  3Comments

aweary picture aweary  Â·  3Comments

timhonders picture timhonders  Â·  3Comments

amcmillan01 picture amcmillan01  Â·  3Comments

blainekasten picture blainekasten  Â·  3Comments