question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'ownerDocument' of null

See original GitHub issue

Environment(required)

  • antd version: 2.8.0
  • OS and its version: Ubuntu 16.04
  • Browser and its version: Google Chrome Versión 57.0.2987.98 (64-bit)

What did you do? Please provide steps to re-produce your problem.

I’m using some components in a project and they fail when I create the snapshots with Jest.

What do you expected?

Works fine.

What happen?

It lauchs this error:

    TypeError: Cannot read property 'ownerDocument' of null
      
      at offset (node_modules/rc-tabs/lib/InkTabBarMixin.js:44:17)
      at _componentDidUpdate (node_modules/rc-tabs/lib/InkTabBarMixin.js:63:25)
      at componentDidMount (node_modules/rc-tabs/lib/InkTabBarMixin.js:116:5)
      at chainedFunction [as componentDidMount] (node_modules/react/lib/ReactClass.js:521:9)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:265:25
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:11
      at CallbackQueue.notifyAll (node_modules/react-test-renderer/lib/CallbackQueue.js:76:22)
      at ReactTestReconcileTransaction.close (node_modules/react-test-renderer/lib/ReactTestReconcileTransaction.js:36:26)
      at ReactTestReconcileTransaction.closeAll (node_modules/react-test-renderer/lib/Transaction.js:206:25)
      at ReactTestReconcileTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:153:16)
      at batchedMountComponentIntoNode (node_modules/react-test-renderer/lib/ReactTestMount.js:69:27)
      at ReactDefaultBatchingStrategyTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:140:20)
      at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactDefaultBatchingStrategy.js:62:26)
      at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactUpdates.js:97:27)
      at Object.render (node_modules/react-test-renderer/lib/ReactTestMount.js:125:18)

But, if i mock ‘antd’ the problem dissapear:

jest.mock('antd');

In fact, it works only mocking the rc-tabs component:

jest.mock('rc-tabs');

The problem is that when I mock the antd/rc-tabs the snapshot is almost empty. For instance:

exports[`test RSFilters Snapshot matchs 1`] = `
<div
  style={
    Object {
      "height": "100%",
    }
  } />
`;

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
afc163commented, Mar 21, 2017

So you shouldn’t mock rc-tabs.

0reactions
lock[bot]commented, May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'ownerDocument ...
I think my view is returning proper JSON but now data is not being added to the .mainContent div. It gives this error:...
Read more >
Can not read property ownerDocument of null #542 - GitHub
I am getting TypeError: Cannot read property 'ownerDocument' of null even if all the required props are passed to Container and element.
Read more >
Cannot read property 'ownerDocument' of undefined - Laracasts
I put a child component called <page-buttons> in my main Vue component. This component has some buttons floating on the page.
Read more >
cannot read properties of null (reading 'ownerdocument')
I am getting TypeError: Cannot read property 'ownerDocument' of null even if all the required props are passed to Container and element. Line...
Read more >
Cannot read property ownerDocument of null - Mendix Forum
The page doesn't receive an object. Perhaps because of access rights or because there is no object passed to the page.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found