From 90aed9ba3a8d2970c23bc81bfca847e7775b6235 Mon Sep 17 00:00:00 2001 From: Julien Brayere Date: Wed, 2 Feb 2022 09:38:26 +0100 Subject: [PATCH] Adding legacy hint for useFakeTimers (#2876) Updating documentation for jest >= 27 since the 'modern' useFakeTimers does not work (yet) with react-native: https://github.com/facebook/jest/issues/10221 ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [X] Updated documentation - [ ] Ensured that CI passes --- docs/docs/guide/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/guide/testing.md b/docs/docs/guide/testing.md index d3d9bee5ec8..c1691428cd8 100644 --- a/docs/docs/guide/testing.md +++ b/docs/docs/guide/testing.md @@ -42,7 +42,7 @@ If you have custom babel configuration for testing, make sure that Reanimated's #### Timers You can use jest timers to control animation ```js -jest.useFakeTimers(); +jest.useFakeTimers(); // jest.useFakeTimers('legacy') for jest >= 27 // call animation jest.runAllTimers(); ``` @@ -91,4 +91,4 @@ More example tests you can see in our repository ## Recommended testing library - [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/) -- [@testing-library/react-hooks](https://react-hooks-testing-library.com/) - for dealing with hooks \ No newline at end of file +- [@testing-library/react-hooks](https://react-hooks-testing-library.com/) - for dealing with hooks