@testing-library/react-hooks
8.0.1 · 18 Jun 2022MIT3M / weekRepositoryHomepagenpmAtom feed
5.1.3 is the newest release of 5.x.
In short
6 breaking2 new8 fixed1 internal
- Breaking
intervalwill now default to 50ms in async utils - Breaking
timeoutwill now default to 1000ms in async utils - Breaking
suppressErrorshas been removed from async utils - Breaking
Adjust types so that react renderer exports don't required extra generic parameter
- Breaking
Importing from
renderHookandactfrom@testing-library/react-hookswill now auto-detect which renderer to used based on the project's dependencies - Breaking
result.currentandresult.errorwill now returnundefinedinstead ofnullwhen 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
intervalwill now default to 50ms in async utils - Breaking
timeoutwill now default to 1000ms in async utils - Breaking
suppressErrorshas been removed from async utils - Breaking
Adjust types so that react renderer exports don't required extra generic parameter
- Breaking
Importing from
renderHookandactfrom@testing-library/react-hookswill now auto-detect which renderer to used based on the project's dependenciespeerDependenciesare now optional to support different dependencies being requiredThis 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.currentandresult.errorwill now returnundefinedinstead ofnullwhen the hook call suspends and they are accessed prior to being set for the first timeNote: 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.