You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jest snapshot tests are failing with invariant Violation #163
recently I've replaced mocha with jest and I love the snapshot testing feature. Unfortunately this does not work for components using the react-list. The tests are failing with an invariant violation:
Invariant Violation: getNodeFromInstance: Invalid argument.
at invariant (node_modules/fbjs/lib/invariant.js:44:15)
at Object.getNodeFromInstance (node_modules/react-dom/lib/ReactDOMComponentTree.js:162:77)
at findDOMNode (node_modules/react-dom/lib/findDOMNode.js:49:41)
at ReactList.getScrollParent (node_modules/react-list/react-list.js:191:18)
at ReactList.updateScrollParent (node_modules/react-list/react-list.js:325:34)
at ReactList.updateFrame (node_modules/react-list/react-list.js:310:14)
at ReactList.componentDidMount (node_modules/react-list/react-list.js:149:14)
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
Googling for this I found some react issues regarding react-test-renderer and react-dom imported by 3rd party libs. Now I am just mocking the react-list in the tests:
Invariant Violation: Minified React error #44; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=44 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
File "webpack:///../~/react-dom/lib/reactProdInvariant.js", line 31, in n
var error = new Error(message);
File "webpack:///../~/react-dom/lib/findDOMNode.js", line 53, in r
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on ...
File "webpack:///../~/react-list/react-list.js", line 218, in value
var el = findDOMNode(this);
File "webpack:///../~/react-list/react-list.js", line 352, in value
this.scrollParent = this.getScrollParent();
File "webpack:///../~/react-list/react-list.js", line 337, in value
this.updateScrollParent();
File "[native code]", line unknown, in value
TypeError: Cannot read property 'styleSheets' of undefined
at Window.getComputedStyle (node_modules/jsdom/lib/jsdom/browser/Window.js:405:36)
at ReactList.getScrollParent (node_modules/react-list/bin/react-list.js:170:24)
at ReactList.updateScrollParent (node_modules/react-list/bin/react-list.js:301:32)
at ReactList.updateFrame (node_modules/react-list/bin/react-list.js:286:12)
at ReactList.componentDidMount (node_modules/react-list/bin/react-list.js:109:12)
at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:25
at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:263: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)```
Activity
maullerz commentedon Feb 7, 2017
Just got similar error in rollbar
the link contains
kachaj7 commentedon Jul 17, 2017
I get similar error with jest.
bseber commentedon Jul 24, 2017
intentional beahviour by react-test-renderer
@see react/react#7371 (comment)
I will update the FAQ and do a pull request as soon as I can spare some time