-
-
Notifications
You must be signed in to change notification settings - Fork 2k
TypeError: Cannot read property 'render' of undefined enzyme-adapter-react-14 #1667
Copy link
Copy link
Closed
Description
Describe the bug
Using stateless arrow functional component lead to an error.
To Reproduce
- Execute code:
import Enzyme, { mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-14'
Enzyme.configure({ adapter: new Adapter() })
const Bar = () => <div>{'Hello'}</div>
class Foo extends React.Component {
render() { return <Bar /> }
}
mount(<Foo />)- See error:
TypeError: Cannot read property 'render' of undefined
at typeToNodeType (node_modules/enzyme-adapter-react-14/build/ReactFourteenAdapter.js:49:31)
at instanceToTree (node_modules/enzyme-adapter-react-14/build/ReactFourteenAdapter.js:85:17)
at instanceToTree (node_modules/enzyme-adapter-react-14/build/ReactFourteenAdapter.js:91:17)
at instanceToTree (node_modules/enzyme-adapter-react-14/build/ReactFourteenAdapter.js:91:17)
at Object.getNode (node_modules/enzyme-adapter-react-14/build/ReactFourteenAdapter.js:149:33)
at new ReactWrapper (node_modules/enzyme/build/ReactWrapper.js:100:33)
at mount (node_modules/enzyme/build/mount.js:19:10)
at Context.it (test.js:10:5)
Expected behavior
Code should works without error.
Desktop (please complete the following information):
- OS: OSX 10.13.4
- Browser: jsdom
- Version: 11.1.0
Additional context
- enzyme: 3.3.0
- enzyme-adapter-react-14: 1.0.5
- react: 0.14.9
Reactions are currently unavailable