diff --git a/src/instrument.js b/src/instrument.js index 60d88762..7ff63a2f 100644 --- a/src/instrument.js +++ b/src/instrument.js @@ -411,6 +411,15 @@ function unliftStore(liftedStore, liftReducer) { * Redux instrumentation store enhancer. */ export default function instrument(monitorReducer = () => null, options = {}) { + /* eslint-disable no-eq-null */ + if (options.maxAge != null && options.maxAge < 2) { + /* eslint-enable */ + throw new Error( + 'DevTools.instrument({ maxAge }) option, if specified, ' + + 'may not be less than 2.' + ); + } + return createStore => (reducer, initialState, enhancer) => { function liftReducer(r) { diff --git a/test/instrument.spec.js b/test/instrument.spec.js index 919b5b28..bc8bfd24 100644 --- a/test/instrument.spec.js +++ b/test/instrument.spec.js @@ -479,6 +479,12 @@ describe('instrument', () => { spy.restore(); }); + + it('should throw error when maxAge < 2', () => { + expect(() => { + createStore(counter, instrument(undefined, { maxAge: 1 })); + }).toThrow(/may not be less than 2/); + }); }); describe('Import State', () => {