backburner >=2.2.0 (ember >=3.2.0) breaks tests which are using fake timers of sinon/lolexSee original GitHub issue
This bug was introduced by the following commit and is included in all backburner releases since
I wasn’t sure whether this issue should have been opened on the ember issue tracker or here, but since the bug is included in this repo, I thought this was the right place.
I’ve created a simple Ember app repo to demonstrate this issue. This demonstration-app is basically just a simple component with a
debounce call and Sinon’s
useFakeTimers method for testing the debounce behavior on a simple class name binding.
>=3.2.0 which includes backburner
>=2.2.0 breaks this test by throwing a TypeError:
Uncaught TypeError: Cannot read property 'apply' of undefined
The issue is caused by a static reference of
setTimeout in some backburner methods which can’t be replaced on the global/window context by sinon or lolex after the
useFakeTimers method has been called:
If you replace the
SET_TIMEOUT reference with simple
setTimeout calls in the built
ember-source/dist/... file and re-run the test, everything is working just fine.
I’m not sure why this
SET_TIMEOUT constant was added, but since I don’t know anything about the internals of this project either, I didn’t want to submit a PR. This looks like a simple mistake, though, because there’s an unused
SET_TIMEOUT constant in the main backburner module here which lead to this bug:
>=2.2.0 is now being used in all Ember releases since
3.2.0, which makes me unable to upgrade my applications from ember
3.1.4 to a newer release. I’d appreciate if older versions could get a patch release, too, after this gets fixed.
- Created 5 years ago