Home / Function/ shouldIgnoreConsoleError() — react Function Reference

shouldIgnoreConsoleError() — react Function Reference

Architecture documentation for the shouldIgnoreConsoleError() function in setupTests.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  60dbaa76_e574_2a7d_2ea1_7c598d65d949["shouldIgnoreConsoleError()"]
  4bb57a78_6434_ff0e_5a01_a28eed969531["setupTests.js"]
  60dbaa76_e574_2a7d_2ea1_7c598d65d949 -->|defined in| 4bb57a78_6434_ff0e_5a01_a28eed969531
  2ee06bbb_2a80_cd1f_54d6_471ebbcb13a4["createMatcherFor()"]
  2ee06bbb_2a80_cd1f_54d6_471ebbcb13a4 -->|calls| 60dbaa76_e574_2a7d_2ea1_7c598d65d949
  style 60dbaa76_e574_2a7d_2ea1_7c598d65d949 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/legacy-jsx-runtimes/setupTests.js lines 11–39

function shouldIgnoreConsoleError(format, args) {
  if (process.env.NODE_ENV !== 'production') {
    if (typeof format === 'string') {
      if (format.indexOf('Error: Uncaught [') === 0) {
        // This looks like an uncaught error from invokeGuardedCallback() wrapper
        // in development that is reported by jsdom. Ignore because it's noisy.
        return true;
      }
      if (format.indexOf('The above error occurred') === 0) {
        // This looks like an error addendum from ReactFiberErrorLogger.
        // Ignore it too.
        return true;
      }
    }
  } else {
    if (
      format != null &&
      typeof format.message === 'string' &&
      typeof format.stack === 'string' &&
      args.length === 0
    ) {
      // In production, ReactFiberErrorLogger logs error objects directly.
      // They are noisy too so we'll try to ignore them.
      return true;
    }
  }
  // Looks legit
  return false;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does shouldIgnoreConsoleError() do?
shouldIgnoreConsoleError() is a function in the react codebase, defined in fixtures/legacy-jsx-runtimes/setupTests.js.
Where is shouldIgnoreConsoleError() defined?
shouldIgnoreConsoleError() is defined in fixtures/legacy-jsx-runtimes/setupTests.js at line 11.
What calls shouldIgnoreConsoleError()?
shouldIgnoreConsoleError() is called by 1 function(s): createMatcherFor.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free