-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Jest 27 - useFakeTimers erases performance.mark and friends #12055
Comments
Not clear why this is an issue? Could you describe some use case, please. Or you try to say that Mock Timers documentation should also mention |
The issue is that there is no way for a developer currently to mock Let me know if more clarification is needed |
Is it only an issue for modern timers? If so, this needs to be fixed upstream in sinon I think |
If I got it right, Sinon is adding It seems like At least two options: either to expose All this is only modern timers related. Legacy timers leave |
They have some node 16 issues, might be related sinonjs/fake-timers#394 |
The use-case is pretty straight-forward:
I'd be ok with any way of making it happen, even things like |
Sorry just realized my code snippet in the description was incorrect and confusing, updated it now. |
I think this issue could be fixed pretty easily be just making avoiding to fake @SimenB I am not to well versed in Jest's use of fake timers, but I do not see any way of passing options to customise its timer faking. If we could exclude |
@benjaminhr - please take a look |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
27.3.1
Steps to reproduce
Expected behavior
jest.useFakeTimers()
to not override global polyfills/mocks of performance.markActual behavior
jest.useFakeTimers()
overrides global polyfills/mocks of performance.mark, and sets it toundefined
.Additional context
I found a similar issue in
@sinonjs/fake-timers
sinonjs/fake-timers#136. Don't know if it's related tojest
though.Environment
The text was updated successfully, but these errors were encountered: