Closed
Description
@testing-library/dom
version: master = v7.29.4
Relevant code or config:
What you did:
Tried to fix #884
What happened:
The test leaks setTimeout
only if jest.useFakeTimers('modern')
has been used in some other test before.
Reproduction:
See relevant code above and parent commits.
Problem description:
Stopping the leak is not sufficient as the side-effect is in the tested unit.
The assumption that jest.getRealSystemTime()
could be used to determine if a modern jest fake timer is active is wrong.
dom-testing-library/src/helpers.js
Lines 43 to 45 in 5bc9364
Suggested solution:
Determine if a jest fake timer is active by calling jest.useRealTimers()
and observing the change of global timer functions.