Skip to content

v7.17.0

Compare
Choose a tag to compare
@kentcdodds kentcdodds released this 23 Jun 16:19
5b2640a

7.17.0 (2020-06-23)

Features

  • waitFor: add complete support for fake timers (#662) (5b2640a), closes #661

🚨 It's possible this will break your tests if you were working around our limitations before. Fixing the issue should be straightforward. Here's an example from my (Kent's) own workaround:

  // using fake timers to skip debounce time
  jest.useFakeTimers()
  userEvent.clear(notesTextarea)
  userEvent.type(notesTextarea, newNotes)
- act(() => jest.runAllTimers())

  await screen.findByLabelText(/loading/i)
  // wait for the loading spinner to go away
  await waitForLoadingToFinish()

  jest.useRealTimers()

Notice that all I needed to change was removing manually advancing timers because now we handle things automatically for you 🎉