testing-library / testing-library/dom-testing-library
Allow fake timers other than jest
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 474
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature you'd like:
This is an follow-on to https://github.com/testing-library/dom-testing-library/issues/939. The request is to support fake timers other than jest. For instance, jest uses @sinonjs/fake-timers under the hood, and yet it's not possible to use @sinonjs/fake-timers directly with testing-library without jest. I would like to be able to use testing-library with @sinonjs/fake-timers without jest.
Suggested implementation:
@eps1lon had a good suggestion in https://github.com/testing-library/dom-testing-library/issues/939#issuecomment-830771708 to decouple testing-library from jest timers, and @MatanBobi suggested doing so in a way that can be set up in the configure step instead of requiring wrappers.
Describe alternatives you've considered:
I have tried to manually advance the clock with clock.tick(), and it works but causes act warnings.
Teachability, Documentation, Adoption, Migration Strategy:
I'm not certain what, if anything, will need to be done in user land to make this work. Ideally, it could be handled under-the-hood within this library, but I'm not sure how that could be done in a robust way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked issue 939 and its suggested approach for decoupling testing-library from Jest timers. Investigate how the configure step could accept @sinonjs/fake-timers, using the reported clock.tick() behavior and resulting act warnings as the baseline. Done means @sinonjs/fake-timers works directly without Jest and avoids those warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100