All files / src/test setupJest.js

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20        7x     7x 7x 7x     7x   3x       7x  
import Enzyme, { shallow, render, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
 
// React 16 Enzyme adapter
Enzyme.configure({ adapter: new Adapter() });
 
// Make Enzyme functions available in all test files without importing
global.shallow = shallow;
global.render = render;
global.mount = mount;
 
// Make requestAnimationFrame fire immediately
global.requestAnimationFrame = (cb) => {
  // remember to call jest.runAllTimers() for fast-forwarding
  setTimeout(cb, 0);
};
 
// https://jestjs.io/docs/en/timer-mocks.html
jest.useFakeTimers();