1. 'use strict';
    
  2. 
    
  3. // Regression tests use a React DOM profiling, so we need
    
  4. // to replace these tests with scheduler/tracing-profiling
    
  5. jest.mock('scheduler/tracing', () => {
    
  6.   return jest.requireActual('scheduler/tracing-profiling');
    
  7. });
    
  8. 
    
  9. // act doesn't exist in older versions of React, but
    
  10. // DevTools tests sometimes import and depend on act to run.
    
  11. // If act doesn't exist for a particular version of React, we will
    
  12. // mock it with a function. This should work in most tests
    
  13. // that we want to call with older versions of React.
    
  14. // TODO (luna) Refactor act in DevTools test utils to not depend
    
  15. // on act in react-dom or react-test-renderer so we don't need to do this
    
  16. jest.mock('react-test-renderer', () => {
    
  17.   const reactTestRenderer = jest.requireActual('react-test-renderer');
    
  18.   if (!reactTestRenderer.act) {
    
  19.     reactTestRenderer.act = fn => fn();
    
  20.   }
    
  21.   return reactTestRenderer;
    
  22. });
    
  23. 
    
  24. jest.mock('react-dom/test-utils', () => {
    
  25.   const testUtils = jest.requireActual('react-dom/test-utils');
    
  26.   if (!testUtils.act) {
    
  27.     testUtils.act = fn => fn();
    
  28.   }
    
  29.   return testUtils;
    
  30. });