Releases: reduxjs/redux-mock-store
v1.5.5 - Deprecation
This patch release deprecates the configureStore
method, as this package does not align with the Redux team's recommended testing practices. Instead, we recommend testing with a real store.
Testing with a mock store leads to potentially confusing behaviour, such as state not updating when actions are dispatched. Additionally, it's a lot less useful to assert on the actions dispatched rather than the observable state changes.
You can test the entire combination of action creators, reducers, and selectors in a single test, for example:
it('should add a todo', () => {
const store = makeStore() // a user defined reusable store factory
store.dispatch(addTodo('Use Redux'))
expect(selectTodos(store.getState())).toEqual([
{ text: 'Use Redux', completed: false }
])
})
This avoids common pitfalls of testing each of these in isolation, such as mocked state shape becoming out of sync with the actual application.
legacy_configureStore
We recognise that for many codebases, migration will be a major effort that some may not be able to allocate time for.
The @deprecated
tag is just a visual strikethrough, but some tools will add extra warnings when it is used.
We now have a legacy_configureStore
export (similar to legacy_createStore
in Redux core) which is the same function but without this tag. You can change any imports to use this if the deprecation notice presents significant issues for you.
- import configureStore from "redux-mock-store"
+ import { legacy_configureStore as configureStore } from "redux-mock-store"
// or
- import { configureStore } from "redux-mock-store"
+ import { legacy_configureStore as configureStore } from "redux-mock-store"
Full Changelog: v1.5.4...v1.5.5
v1.5.3
Fixing the breaking changes by reverting package to the version 1.4.0.
v1.4.0
Merge pull request #116 from mayank23/master conform more to basic redux behavior for dispatch.