@testing-library/react-hooks
Advanced tools
Comparing version 4.0.0 to 4.0.1
import React from 'react'; | ||
import { act } from 'react-test-renderer'; | ||
import { cleanup, addCleanup, removeCleanup } from './cleanup'; | ||
declare function renderHook<TProps, TResult>(callback: (props: TProps) => TResult, { initialProps, wrapper }?: { | ||
export interface RenderHookOptions<TProps> { | ||
initialProps?: TProps; | ||
wrapper?: React.ComponentType<TProps>; | ||
}): { | ||
} | ||
declare function renderHook<TProps, TResult>(callback: (props: TProps) => TResult, { initialProps, wrapper }?: RenderHookOptions<TProps>): { | ||
waitFor: (callback: () => boolean | void, { interval, timeout, suppressErrors }?: import("./asyncUtils").WaitOptions) => Promise<void>; | ||
@@ -9,0 +10,0 @@ waitForNextUpdate: ({ timeout }?: Pick<import("./asyncUtils").WaitOptions, "timeout">) => Promise<void>; |
@@ -152,2 +152,9 @@ "use strict"; | ||
function rerenderHook(newProps = hookProps.current) { | ||
hookProps.current = newProps; | ||
(0, _reactTestRenderer.act)(() => { | ||
testRenderer.update(toRender()); | ||
}); | ||
} | ||
function unmountHook() { | ||
@@ -163,8 +170,3 @@ (0, _reactTestRenderer.act)(() => { | ||
result, | ||
rerender: function (newProps = hookProps.current) { | ||
hookProps.current = newProps; | ||
(0, _reactTestRenderer.act)(() => { | ||
testRenderer.update(toRender()); | ||
}); | ||
}, | ||
rerender: rerenderHook, | ||
unmount: unmountHook, | ||
@@ -171,0 +173,0 @@ ...(0, _asyncUtils.default)(addResolver) |
{ | ||
"name": "@testing-library/react-hooks", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Simple and complete React hooks testing utilities that encourage good testing practices.", | ||
@@ -53,4 +53,4 @@ "main": "lib/index.js", | ||
"docz-utils": "2.3.0", | ||
"eslint": "7.15.0", | ||
"kcd-scripts": "7.5.3", | ||
"eslint": "7.17.0", | ||
"kcd-scripts": "7.5.4", | ||
"prettier": "^2.2.1", | ||
@@ -57,0 +57,0 @@ "react": "17.0.1", |
@@ -29,3 +29,3 @@ <div align="center"> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/github/all-contributors/testing-library/react-hooks-testing-library?color=orange&style=flat-square)](#contributors) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) | ||
@@ -170,3 +170,3 @@ [![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square)](https://github.com/testing-library/react-hooks-testing-library/blob/master/CODE_OF_CONDUCT.md) | ||
<tr> | ||
<td align="center"><a href="https://github.com/mpeyper"><img src="https://avatars0.githubusercontent.com/u/23029903?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michael Peyper</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Code">💻</a> <a href="#design-mpeyper" title="Design">🎨</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Documentation">📖</a> <a href="#ideas-mpeyper" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-mpeyper" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-mpeyper" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Tests">⚠️</a> <a href="#tool-mpeyper" title="Tools">🔧</a></td> | ||
<td align="center"><a href="https://github.com/mpeyper"><img src="https://avatars0.githubusercontent.com/u/23029903?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michael Peyper</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Code">💻</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Documentation">📖</a> <a href="#infra-mpeyper" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=mpeyper" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/otofu-square"><img src="https://avatars0.githubusercontent.com/u/10118235?v=4?s=100" width="100px;" alt=""/><br /><sub><b>otofu-square</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=otofu-square" title="Code">💻</a></td> | ||
@@ -194,3 +194,3 @@ <td align="center"><a href="https://github.com/ab18556"><img src="https://avatars2.githubusercontent.com/u/988696?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Patrick P. Henley</b></sub></a><br /><a href="#ideas-ab18556" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/react-hooks-testing-library/pulls?q=is%3Apr+reviewed-by%3Aab18556" title="Reviewed Pull Requests">👀</a></td> | ||
<td align="center"><a href="https://huchen.dev/"><img src="https://avatars3.githubusercontent.com/u/2078389?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hu Chen</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=huchenme" title="Code">💻</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=huchenme" title="Documentation">📖</a> <a href="#example-huchenme" title="Examples">💡</a></td> | ||
<td align="center"><a href="https://github.com/joshuaellis"><img src="https://avatars0.githubusercontent.com/u/37798644?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josh</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=joshuaellis" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/joshuaellis"><img src="https://avatars0.githubusercontent.com/u/37798644?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josh</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=joshuaellis" title="Documentation">📖</a> <a href="#question-joshuaellis" title="Answering Questions">💬</a></td> | ||
<td align="center"><a href="https://github.com/Goldziher"><img src="https://avatars1.githubusercontent.com/u/30733348?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Na'aman Hirschfeld</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=Goldziher" title="Code">💻</a></td> | ||
@@ -205,3 +205,29 @@ </tr> | ||
<td align="center"><a href="https://github.com/jensmeindertsma"><img src="https://avatars3.githubusercontent.com/u/64677517?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jens Meindertsma</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=jensmeindertsma" title="Code">💻</a> <a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=jensmeindertsma" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/marcosvega91"><img src="https://avatars2.githubusercontent.com/u/5365582?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marco Moretti</b></sub></a><br /><a href="#infra-marcosvega91" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://www.parkside.at/"><img src="https://avatars0.githubusercontent.com/u/27507295?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Martin V.</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=ndresx" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/erozak"><img src="https://avatars3.githubusercontent.com/u/22066282?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Erozak</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=erozak" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://nickmccurdy.com/"><img src="https://avatars0.githubusercontent.com/u/927220?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick McCurdy</b></sub></a><br /><a href="#maintenance-nickmccurdy" title="Maintenance">🚧</a></td> | ||
<td align="center"><a href="https://codepen.io/aryyya/"><img src="https://avatars1.githubusercontent.com/u/29365565?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arya</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=aryyya" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://numb86.net/"><img src="https://avatars1.githubusercontent.com/u/16703337?v=4?s=100" width="100px;" alt=""/><br /><sub><b>numb86</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=numb86" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/foray1010"><img src="https://avatars3.githubusercontent.com/u/3212221?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex Young</b></sub></a><br /><a href="#maintenance-foray1010" title="Maintenance">🚧</a></td> | ||
<td align="center"><a href="https://blam.sh/"><img src="https://avatars1.githubusercontent.com/u/3645856?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ben Lambert</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=benjdlambert" title="Documentation">📖</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/ElRatonDeFuego"><img src="https://avatars1.githubusercontent.com/u/12750934?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Cho-Lerat</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=ElRatonDeFuego" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/evanharmon"><img src="https://avatars1.githubusercontent.com/u/8229989?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evan Harmon</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=evanharmon" title="Documentation">📖</a></td> | ||
<td align="center"><a href="http://codedaily.io/"><img src="https://avatars1.githubusercontent.com/u/1714673?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jason Brown</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=browniefed" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/kahwee"><img src="https://avatars1.githubusercontent.com/u/262105?v=4?s=100" width="100px;" alt=""/><br /><sub><b>KahWee Teng</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=kahwee" title="Documentation">📖</a></td> | ||
<td align="center"><a href="http://shagabutdinov.com/"><img src="https://avatars2.githubusercontent.com/u/1635613?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Leonid Shagabutdinov</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=shagabutdinov" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://levibutcher.dev/"><img src="https://avatars2.githubusercontent.com/u/31522433?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Levi Butcher</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=LeviButcher" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/7michele7"><img src="https://avatars2.githubusercontent.com/u/17926167?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michele Settepani</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=7michele7" title="Documentation">📖</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/samnoh"><img src="https://avatars1.githubusercontent.com/u/14857416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sam</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=samnoh" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/tanaypratap"><img src="https://avatars0.githubusercontent.com/u/10216863?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tanay Pratap</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=tanaypratap" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/techanvil"><img src="https://avatars0.githubusercontent.com/u/18395600?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tom Rees-Herdman</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=techanvil" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/iqbal125"><img src="https://avatars2.githubusercontent.com/u/24860061?v=4?s=100" width="100px;" alt=""/><br /><sub><b>iqbal125</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=iqbal125" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/cliffzhaobupt"><img src="https://avatars3.githubusercontent.com/u/7374506?v=4?s=100" width="100px;" alt=""/><br /><sub><b>cliffzhaobupt</b></sub></a><br /><a href="#maintenance-cliffzhaobupt" title="Maintenance">🚧</a></td> | ||
</tr> | ||
</table> | ||
@@ -208,0 +234,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45127
559
270