UNPKG

@helpscout/cyan

Version:

Cypress-like Testing for React + JSDOM

28 lines (25 loc) 709 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var mockImplementation = function () { // Cache the mock implementation in scope var raf; beforeEach(function () { raf = jest.spyOn(window, 'requestAnimationFrame').mockImplementation(function (cb) { // Handle edge-case where the callback is a Function: schedule. // Otherwise, a maximum callstack issue happens, and Jest blows up. if (cb.name !== 'schedule') { return cb(); } }); }); afterEach(function () { // Restore and reset raf && raf.mockRestore(); raf = null; }); }; var _default = mockImplementation; exports.default = _default;