erikras / erikras/react-redux-universal-hot-example
API unit tests are very slow due to setTimeout on widget code
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Unit tests on the API are very, very slow. I started playing around with adding a bit more test coverage, but had to disable the widget tests while working because of the intentional 1-1.5 second timeouts.
Normally I'd stub something out if it's slow, or use nock to mock out a network request, but this isn't a real request.
I can make a pull request to bypass the delay, but I'm curious of your opinion on the possible approaches:
- Change the code to use a different delay based on environment (test/dev/prod).
- Change the code to accept an argument for delay.
- Use sinon.useFakeTimers(). This will completely isolate changes to tests, but is very brute-force and can have unexpected effects on any libraries using setTimeout / setImmediate.
Contributor guide
Assessment
This issue has not been assessed yet.