-
Notifications
You must be signed in to change notification settings - Fork 49.4k
Closed
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
When react-dom v15.5.4 throws an error during jest tests using test-utils, error messages can be so cryptic. Makes it harder for us developers to understand the problem. For example this one:
TypeError: Cannot read property '__reactInternalInstance$snz0ajvq2ztcsor' of undefined
at getClosestInstanceFromNode (node_modules/react-dom/lib/ReactDOMComponentTree.js:113:11)
at Object.getInstanceFromNode (node_modules/react-dom/lib/ReactDOMComponentTree.js:147:14)
at Object.change (node_modules/react-dom/lib/ReactTestUtils.js:336:74)
at Object.<anonymous> (src/modules/views/form/__jest__/CancelSubmitButtons.es:34:34)
at process._tickCallback (node.js:369:9)
Can't you put something more "readable" in __reactInternalInstance$snz0ajvq2ztcsor
instead? Like what it's parent node is, what its tag name is etc. Would be extremely useful.
Using this test code btw:
it('onCancel is fired', (done) => {
const component = TestUtils.renderIntoDocument(
<CancelSubmitButton
disableCancel={false}
onCancel={e => {
expect(e.target.innerHTML).toEqual('Cancel')
done()
}}
/>
)
TestUtils.Simulate.click(component.refs.cancel, {target: {innerHTML: 'Cancel'}})
})
Tyguy7
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug