diff --git a/.all-contributorsrc b/.all-contributorsrc index 53aaac86..46813049 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -111,6 +111,16 @@ "bug", "code" ] + }, + { + "login": "apostolidhs", + "name": "John Apostolidis", + "avatar_url": "https://avatars3.githubusercontent.com/u/2164902?v=4", + "profile": "http://apostolidis.me", + "contributions": [ + "code", + "doc" + ] } ], "commitConvention": "none" diff --git a/README.md b/README.md index be2d6204..e942d2c0 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ [](http://www.npmtrends.com/@testing-library/react-hooks) [](https://github.com/testing-library/react-hooks-testing-library/blob/master/LICENSE.md) -[](#contributors) +[](#contributors) [](http://makeapullrequest.com) [](https://github.com/testing-library/react-hooks-testing-library/blob/master/CODE_OF_CONDUCT.md) [](https://app.netlify.com/sites/react-hooks-testing-library/deploys) @@ -126,6 +126,17 @@ npm install --save-dev react-test-renderer@^x.y.z Both of these dependecies must be installed as at least version `16.8.0` to be compatible with `react-hooks-testing-library`. +### `cleanup()` + +Unmounts any of the Hooks that were mounted with `renderHook`. + +Optionally, it is possible to import `cleanup` in a global test file. Using that way, it isn't +necessary to run `afterEach(cleanup)` on every test script. + +```js +import 'react-hooks-testing-library/cleanup-after-each' +``` + ## Documentation There are some [work-in-progress docs here](https://react-hooks-testing-library.com/). Please leave @@ -143,7 +154,23 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d -
Michael Peyper 💻 🎨 📖 🤔 🚇 📦 ⚠️ 🔧 | otofu-square 💻 | Patrick P. Henley 🤔 👀 | Matheus Marques 💻 | Dhruv Patel 🐛 👀 | Nathaniel Tucker 🐛 👀 | Sergei Grishchenko 💻 📖 🤔 |
Josep M Sobrepere 📖 | Marcel Tinner 📖 | Daniel K. 🐛 💻 |
Michael Peyper 💻 🎨 📖 🤔 🚇 📦 ⚠️ 🔧 |
+ otofu-square 💻 |
+ Patrick P. Henley 🤔 👀 |
+ Matheus Marques 💻 |
+ Dhruv Patel 🐛 👀 |
+ Nathaniel Tucker 🐛 👀 |
+ Sergei Grishchenko 💻 📖 🤔 |
+
Josep M Sobrepere 📖 |
+ Marcel Tinner 📖 |
+ Daniel K. 🐛 💻 |
+ John Apostolidis 💻 📖 |
+
( callback: (props: P) => R, options?: RenderHookOptions
): RenderHookResult
+ +export function cleanup(): void