Skip to content

Update docs, add test, alias ignore->ignoredPaths #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

msutkowski
Copy link
Member

Fixes #491

@netlify
Copy link

netlify bot commented Apr 10, 2020

Deploy preview for redux-starter-kit-docs ready!

Built with commit 23bb427

https://deploy-preview-492--redux-starter-kit-docs.netlify.com

@msutkowski
Copy link
Member Author

@markerikson When we inlined this middleware, I just moved the tests over as they were and didn't update anything outside of the types. I propose changing this test:

  it('Should not print a warning if "next" takes too long', () => {
    const next: Dispatch = action => {
      const started = Date.now()
      while (Date.now() - started < 8) {}
      return action
    }

    const dispatch = middleware({ warnAfter: 4 })(next)

    const restore = mockConsole(createConsole())
    try {
      dispatch({ type: 'SOME_ACTION' })
      expect(getLog().log).toEqual('')
    } finally {
      restore()
    }
  })
})

to this:

  it('Should not print a warning if execution completes before the warnAfter threshold', () => {
    const next: Dispatch = action => action

    const dispatch = middleware({ warnAfter: 32 })(next) 

    const restore = mockConsole(createConsole())
    try {
      dispatch({ type: 'SOME_ACTION' })
      expect(getLog().log).toEqual('')
    } finally {
      restore()
    }
  })
})

@markerikson
Copy link
Collaborator

markerikson commented Apr 11, 2020

The point of that test is to make sure we're only measuring the time the middleware itself takes to execute. If a reducer takes a long time, that's not something we want to warn about. Also, that's a test we specifically added while working on 1.3.0, when we added the warnAfter option (which isn't part of the original immutable middleware package).

So, leave that test as-is.

@markerikson markerikson merged commit e56246d into reduxjs:master Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outdated documentation of immutable invariant options on the homepage
2 participants