Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test("works with devtools store enhancer", () => {
const monitorReducer = state => state;
const store = createStore(
defaultReducer,
compose(offline(defaultConfig), instrument(monitorReducer))
);
expect(() => {
store.dispatch({ type: "SOME_ACTION" });
}).not.toThrow();
});
test('works with preloadState and redux-devtools-instrumentation', t => {
const enhancedReducer = combineReducers({
counter: optimistic(counterReducer)
});
try {
const store = createStore(enhancedReducer, {
counter: 1
}, instrument((state, action) => state));
store.dispatch({type: 'INC'});
t.is(ensureState(store.getState().counter), 2);
} catch (error) {
t.fail(error.message)
}
});
export default function configureStore(next, monitorReducer, config) {
return compose(
instrument(
monitorReducer,
{
maxAge: config.maxAge || window.devToolsOptions.maxAge || 50,
stringifyActionTypes: !config.serialize,
shouldCatchErrors: config.shouldCatchErrors || window.shouldCatchErrors,
shouldHotReload: config.shouldHotReload,
shouldRecordChanges: config.shouldRecordChanges,
shouldStartLocked: config.shouldStartLocked,
pauseActionType: config.pauseActionType || '@@PAUSED'
}
),
persistState(
getUrlParam('debug_session'),
config.deserializeState,
config.deserializeAction
)
static instrument = (options) => instrument(
(state, action) => Monitor.update(monitorProps, state, action),
options
);
export default function configureStore(next, monitorReducer, config) {
return compose(
instrument(
monitorReducer,
{
maxAge: config.maxAge,
shouldCatchErrors: config.shouldCatchErrors || window.shouldCatchErrors,
shouldHotReload: config.shouldHotReload,
shouldRecordChanges: config.shouldRecordChanges,
shouldStartLocked: config.shouldStartLocked,
pauseActionType: config.pauseActionType || '@@PAUSED'
}
),
persistState(
getUrlParam('debug_session'),
config.deserializeState,
config.deserializeAction
)
)(next);
function configureStore(next, subscriber, options) {
return instrument(subscriber, options)(next);
}
export default function configureStore(next, subscriber, options) {
return instrument(subscriber, options)(next);
}