ng-redux
ng-redux copied to clipboard
TypeError: _redux.compose.apply(...) is not a function
Hi all, I'm implementing ng-redux in an old project, all works fine in development but all karma tests fails with the message:
TypeError: _redux.compose.apply(...) is not a function
May I need to add something to karma.conf?
I have the same issue.
is there someone here who has resolved this issue or has a solution for that?
@karlos1337 @guysenpai Can either of you guys create a repo reproducing this so we can take a look?
@karlos1337 @guysenpai For what it's worth, we had the same issue in our project, and it ended up being an problem with the redux dev tools not being available in the headless browser that karma was using.
We fixed it by conditionally checking if the redux tools were available before trying to pass them to $ngReduxProvider.createStoreWith
.
Example:
const reduxDevTools:Function = _.get(window, '__REDUX_DEVTOOLS_EXTENSION__');
const enhancers = reduxDevTools ? [reduxDevTools()] : null;
const reduxBootstrap = $ngReduxProvider => {
$ngReduxProvider.createStoreWith(reducer, [thunk], enhancers);
}