redux-mock-store icon indicating copy to clipboard operation
redux-mock-store copied to clipboard

redux-mock-store throws error after updating jest to latest versions

Open shabeerwebdev opened this issue 1 year ago • 2 comments

package.json "@testing-library/dom": "10.1.0", "@testing-library/jest-dom": "6.4.5", "@testing-library/react": "15.0.7", "@testing-library/react-hooks": "^8.0.1", "@testing-library/user-event": "14.5.2", "redux-mock-store": "^1.5.4",

Error ● Test suite failed to run TypeError: middleware is not a function

  10 |
  11 | const mockStore = configureMockStore([thunk]);
> 12 | const store = mockStore({
     |                           ^

shabeerwebdev avatar May 09 '24 05:05 shabeerwebdev

I foresee it because you have upgraded the redux-thunk library. In the latest version, they do not use the default export.

Check your thunk import:

import { thunk } from 'redux-thunk'

this-self avatar Jul 12 '24 00:07 this-self

I foresee it because you have upgraded the redux-thunk library. In the latest version, they do not use the default export.

Check your thunk import:

import { thunk } from 'redux-thunk'

As for me, the project i'm working on uses redux-toolkit (it doesn't have the explicit redux-thunk package installed). But this solution works indeed. Thanks you @ifree92

moiseshilario avatar Aug 07 '24 17:08 moiseshilario