Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Keksike opened this issue Oct 3, 2017 · 13 comments
Closed

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

Keksike opened this issue Oct 3, 2017 · 13 comments

Comments

@Keksike
Copy link

Keksike commented Oct 3, 2017

Similar problem as #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:

react@16.0.0-alpha.6
react-test-renderer@16.0.0
enzyme@3.0.0
enzyme-adapter-react-16@1.0.0

react-native@0.44.0
react-native-mock-render@0.0.9
jest@21.2.1

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

@Keksike Keksike changed the title TypeError: Cannot read property 'rendered' of null Enzyme mount(): TypeError: Cannot read property 'rendered' of null Oct 3, 2017
@eddiemonge
Copy link

Happens without react-native as well

@eddiemonge
Copy link

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

@michaelgmcd
Copy link

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 react@16.0.0 fixed this issue.

@ljharb
Copy link
Member

ljharb commented Oct 26, 2017

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?

@michaelgmcd
Copy link

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

@ljharb
Copy link
Member

ljharb commented Oct 27, 2017

ok - we should lift the peer dep to that.

@patrickford
Copy link

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

@drewjenkins
Copy link

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

@patrickford
Copy link

patrickford commented Feb 23, 2018 via email

@developer239
Copy link

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

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

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

@ljharb ljharb closed this as completed Jun 29, 2018
@sanatg7582

This comment has been minimized.

@ljharb

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants