I am using sinon-fake-timers together with jest, because jest's exposes only minimal part of sinon timers and I need more advanced capabilities. The thing is that React native testing library mistakenly thinks that I am using "jest.useFakeTimers", because of this check:
if ( typeof globalObj.setTimeout.clock !== 'undefined' && // $FlowIgnore[prop-missing] typeof jest.getRealSystemTime !== 'undefined' )
The first statement is true because I am using sinon fake timers, and the second is true because I am using jest, so it assumes that I am using jest.useFakeTimers
, and it automatically turn it on for me here:
if (fakeTimersType) { jest.useFakeTimers(fakeTimersType); }
This results in both custom sinon timer and jest's fake timers being installed, and it causes issues in my tests.
Expected behaviorjest.useFakeTimers
should not be called if the user didn't call it explicitly.
use jest 27 and sinon-fake-timers
VersionsnpmPackages:
@testing-library/react-native: ^9.0.0 => 9.0.0
react-test-renderer: ^17.0.2 => 17.0.2
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4