Skip to content

v5.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 13 Jan 21:58
b81fd04

5.0.0 (2021-01-13)

Bug Fixes

  • constrain TOptions to be an object instead of an empty interface (3813b88)
  • display returned function names correctly in stack traces (#528) (a82d5ef)
  • fixed potential error when hook suspends and current result is accessed (dc21e59)
  • include render utils in RenderHook type (ca32bce)
  • ReactHooksRenderer renderHook was not expecting arguments (bb870e0)
  • stop appending container elements to document body (bab38d9)
  • Type for options in autodetected renderer was incorrectly inferring any passed type (#527) (4786242)
  • use actual line break in error message when auto-detect fails (a3fd0e2)

Code Refactoring

Features

  • react-dom and SSR compatible rendering (a25993f)
  • use error boundary to capture useEffect errors (#539) (b81fd04), closes #308

BREAKING CHANGES

  • interval will now default to 50ms in async utils
  • timeout will now default to 1000ms in async utils
  • suppressErrors has been removed from async utils
  • Adjust types so that react renderer exports don't required extra generic parameter
  • 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
  • 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