Packages

@testing-library/react-hooks

8.0.1 · 18 Jun 2022MIT3M / weekRepositoryHomepagenpmAtom feed

Your version

5.0.0

major13 Jan 2021Where it was published

5.1.3 is the newest release of 5.x.

In short

6 breaking2 new8 fixed1 internal

  • Breaking

    interval will now default to 50ms in async utils

  • Breaking

    timeout will now default to 1000ms in async utils

  • Breaking

    suppressErrors has been removed from async utils

  • Breaking

    Adjust types so that react renderer exports don't required extra generic parameter

  • Breaking

    Importing from renderHook and act from @testing-library/react-hooks will now auto-detect which renderer to used based on the project's dependencies

  • Breaking

    result.current and result.error will now return undefined instead of null when the hook call suspends and they are accessed prior to being set for the first time

Release note

Bug Fixes

  • Constrain TOptions to be an object instead of an empty interface

  • Display returned function names correctly in stack traces

  • Fixed potential error when hook suspends and current result is accessed

  • Include render utils in RenderHook type

  • ReactHooksRenderer renderHook was not expecting arguments

  • Stop appending container elements to document body

  • Type for options in autodetected renderer was incorrectly inferring any passed type

  • Use actual line break in error message when auto-detect fails

Features

  • react-dom and SSR compatible rendering

  • Use error boundary to capture useEffect errors (#539) (b81fd04), closes #308

Breaking changes

  • Breaking

    interval will now default to 50ms in async utils

  • Breaking

    timeout will now default to 1000ms in async utils

  • Breaking

    suppressErrors has been removed from async utils

  • Breaking

    Adjust types so that react renderer exports don't required extra generic parameter

  • Breaking

    Importing from renderHook and act from @testing-library/react-hooks will now auto-detect which renderer to used based on the project's dependencies

    • peerDependencies are now optional to support different dependencies being required

    • This means there will be no warning if the dependency is not installed at all, but it will still warn if an incompatible version is installed

    • Auto-detection won't work with bundlers (e.g. Webpack). Please use as specific renderer import instead

  • Breaking

    result.current and result.error will now return undefined instead of null when the hook call suspends and they are accessed prior to being set for the first time

    • Note: accessing these values in a suspending scenario has been broken since version 3.6.0

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.