TheBrainFamily / wait-for-expect

Wait for expectation to be true, useful for integration and end to end testing. Integral part of react-testing-library.
MIT License
293 stars 31 forks source link

Add runWithRealTimers & getSetTimeoutFn functions #22

Closed brapifra closed 5 years ago

brapifra commented 5 years ago

After a long discussion in https://github.com/testing-library/dom-testing-library/pull/342, we ended up getting to the conclusion that it's better to have a util runWithRealTimers function that ensures that the passed callback is always run with real timers. This function can also be extended to support other test runners as I mention in the comment that I left in the code.

TL;DR With this addition, developers won't have to worry about using real or fake timers because wait-for-expect will always use the real ones :smiley:

lgandecki commented 5 years ago

Closed in #23