You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nock library is not compatible with the fake timers we use in unit tests because it uses the Node.js timers API. This API is not mocked correctly by the version of Jest we are using.
Jest uses @sinon/fake-timers internally, which didn't support mocking the Node.js timers API until v11.0.0 (see sinonjs/fake-timers#467) This package is updated in Jest as part of the v30 release, which is currently under development.
Elsewhere we have worked around this problem by patching the nock library to use global timers rather than the timers API. Global timers are mocked correctly by our fake timers. We should implement the same fix here, so that fake timers work more predictably. We can remove this workaround when we update to Jest v30.
I suspect that we haven't seen this issue come up in core yet because all of our nock delays use very small intervals, so we don't notice that they aren't correctly mocked.
The text was updated successfully, but these errors were encountered:
The
nock
library is not compatible with the fake timers we use in unit tests because it uses the Node.jstimers
API. This API is not mocked correctly by the version of Jest we are using.Jest uses
@sinon/fake-timers
internally, which didn't support mocking the Node.jstimers
API until v11.0.0 (see sinonjs/fake-timers#467) This package is updated in Jest as part of the v30 release, which is currently under development.Elsewhere we have worked around this problem by patching the
nock
library to use global timers rather than thetimers
API. Global timers are mocked correctly by our fake timers. We should implement the same fix here, so that fake timers work more predictably. We can remove this workaround when we update to Jest v30.See here for how we did this in the extension repository: MetaMask/metamask-extension#24805
I suspect that we haven't seen this issue come up in core yet because all of our nock delays use very small intervals, so we don't notice that they aren't correctly mocked.
The text was updated successfully, but these errors were encountered: