Skip to content

Conversation

@thymikee
Copy link
Member

@thymikee thymikee commented Jun 22, 2020

Summary

Fixes #391

Test plan

Added regression tests.

@thymikee thymikee force-pushed the fix/timers-modern branch from eeadc85 to 360f71f Compare July 10, 2020 13:05
@thymikee thymikee marked this pull request as ready for review July 10, 2020 14:03
Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thymikee thymikee merged commit 111b1c9 into master Jul 10, 2020
@thymikee thymikee deleted the fix/timers-modern branch July 30, 2020 14:30
@pke
Copy link
Contributor

pke commented Nov 19, 2020

I wanted to report, that modern fake timers still (again?) don't work in @testing-library/[email protected]
When enabled all tests run into timeouts.

test("renders greeting depending on time", () => {
  jest.useFakeTimers("modern")
  jest.setSystemTime(new Date("2020-11-19T09:00:00.000+01:00"))
  const { getByText } = render(<Greeting/>)
  expect(getByText("Good day)).toBeTruthy()
})

Uncommenting the first 2 lines in the test make it work (but now always pass due to its dependency on current time).

@thymikee
Copy link
Member Author

@pke we're aware of the issue and tracking it here: #506 Feel free to help reviewing and testing the ongoing work: #568 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 2.x not compatible with jest.useFakeTimers('modern');

4 participants