Skip to content

Updated setTimeout to not be affected by test mocks

Compare
Choose a tag to compare
@taylorhakes taylorhakes released this 09 Jan 16:46
· 158 commits to master since this release

In version 2 mocking setTimeout in Jasmine and Sinon would affect promise-polyfill resolution. Since native Promise is not affected by mocks, this library has been updated to behave the same way.

This is considered a breaking change because people may have been using this functionality. If you would like to keep version 2 functionality, set Promise._setImmediateFn on promise-polyfill like the code below.

var Promise = require('promise-polyfill');
Promise._setImmedateFn(function(fn) {
  setTimeout(fn, 1);
});