jest-shim.ts 395 B

1234567891011121314151617
  1. declare var global: NodeJS.Global;
  2. (global as any).requestAnimationFrame = callback => {
  3. setTimeout(callback, 0);
  4. };
  5. (Promise.prototype as any).finally = function(onFinally) {
  6. return this.then(
  7. /* onFulfilled */
  8. res => Promise.resolve(onFinally()).then(() => res),
  9. /* onRejected */
  10. err =>
  11. Promise.resolve(onFinally()).then(() => {
  12. throw err;
  13. })
  14. );
  15. };