Skip to content

react-test-renderer/shallow render throws TypeError: Cannot read property 'current' of undefined #14763

Closed
@vjrasane

Description

@vjrasane

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

TypeError: Cannot read property 'current' of undefined

       6 |   it('renders correctly', () => {
       7 |     const renderer = new ShallowRenderer()
    >  8 |     const render = renderer.render(
         |                             ^
       9 |       <StatusChip
      10 |         status={'Acknowledged'}
      11 |         text={'IN PROGRESS'}

      at ReactShallowRenderer.render (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:703:53)
      at Object.render (src/components/StatusChip/index.snapshot.test.jsx:8:29)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

Run ShallowRenderers render method

What is the expected behavior?

render should return shallow render of the given component

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

"react": "16.6.3",
"react-test-renderer": "16.8.0",
"enzyme": "3.7.0",
"enzyme-adapter-react-16": "1.7.0",
"jest": "24.0.0"

Workaround is to add:

"resolutions": {
"react-test-renderer": "16.7.0"
}

(for yarn)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions