1. 'use strict';
    
  2. 
    
  3. module.exports = function shouldIgnoreConsoleError(format, args) {
    
  4.   if (__DEV__) {
    
  5.     if (typeof format === 'string') {
    
  6.       if (format.indexOf('Error: Uncaught [') === 0) {
    
  7.         // This looks like an uncaught error from invokeGuardedCallback() wrapper
    
  8.         // in development that is reported by jsdom. Ignore because it's noisy.
    
  9.         return true;
    
  10.       }
    
  11.       if (format.indexOf('The above error occurred') === 0) {
    
  12.         // This looks like an error addendum from ReactFiberErrorLogger.
    
  13.         // Ignore it too.
    
  14.         return true;
    
  15.       }
    
  16.       if (
    
  17.         format.indexOf('ReactDOM.render is no longer supported in React 18') !==
    
  18.           -1 ||
    
  19.         format.indexOf(
    
  20.           'ReactDOM.hydrate is no longer supported in React 18'
    
  21.         ) !== -1
    
  22.       ) {
    
  23.         // We haven't finished migrating our tests to use createRoot.
    
  24.         return true;
    
  25.       }
    
  26.     } else if (
    
  27.       format != null &&
    
  28.       typeof format.message === 'string' &&
    
  29.       typeof format.stack === 'string' &&
    
  30.       args.length === 0
    
  31.     ) {
    
  32.       if (format.stack.indexOf('Error: Uncaught [') === 0) {
    
  33.         // This looks like an uncaught error from invokeGuardedCallback() wrapper
    
  34.         // in development that is reported by jest-environment-jsdom. Ignore because it's noisy.
    
  35.         return true;
    
  36.       }
    
  37.     }
    
  38.   } else {
    
  39.     if (
    
  40.       format != null &&
    
  41.       typeof format.message === 'string' &&
    
  42.       typeof format.stack === 'string' &&
    
  43.       args.length === 0
    
  44.     ) {
    
  45.       // In production, ReactFiberErrorLogger logs error objects directly.
    
  46.       // They are noisy too so we'll try to ignore them.
    
  47.       return true;
    
  48.     }
    
  49.   }
    
  50.   // Looks legit
    
  51.   return false;
    
  52. };