jest-shim.ts 386 B

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