React-testing-library: Cannot read property 'subscribe' of undefined when upgrading to react-redux:6.0.0

Created on 5 Dec 2018  路  3Comments  路  Source: testing-library/react-testing-library

Hi,

I have a CI to upgrade dependencies and I'm having this error in my tests when trying to upgrade to react-redux to v6.0.0

TypeError: Cannot read property 'subscribe' of undefined
> 20 |     const { container } = render(mockComponent(Step1, { initialProps }));
         |                         ^

It's something related to this library or I have to open bug in reac-redux github?

Thanks

Most helpful comment

My guess is that you have to do the render this way:

render(
  <Provider store={store}>
    <MyComponent />
  </Provider>
)

All 3 comments

To me, it looks related to your component. What does mockComponent render?

My guess is that your component expects some sort of context that you need to provide.

Yes, now I see that it's also breaking all my project. I'm gonna try to fix it.

My guess is that you have to do the render this way:

render(
  <Provider store={store}>
    <MyComponent />
  </Provider>
)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaredmeakin picture jaredmeakin  路  3Comments

mezei picture mezei  路  3Comments

aganglada picture aganglada  路  4Comments

jalvarado91 picture jalvarado91  路  3Comments

joshvillahermosa picture joshvillahermosa  路  3Comments