Home / Function/ shouldIgnoreConsoleErrorOrWarn() — react Function Reference

shouldIgnoreConsoleErrorOrWarn() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3957f974_a9fb_cc07_c98c_c23acd5dea05["shouldIgnoreConsoleErrorOrWarn()"]
  7a8b988c_a832_ec08_c36e_22d30113be12["setupTests.js"]
  3957f974_a9fb_cc07_c98c_c23acd5dea05 -->|defined in| 7a8b988c_a832_ec08_c36e_22d30113be12
  6688189a_a8d0_9baf_b39a_667bff44d4ea["patchConsoleForTestingBeforeHookInstallation()"]
  6688189a_a8d0_9baf_b39a_667bff44d4ea -->|calls| 3957f974_a9fb_cc07_c98c_c23acd5dea05
  style 3957f974_a9fb_cc07_c98c_c23acd5dea05 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/__tests__/setupTests.js lines 107–132

function shouldIgnoreConsoleErrorOrWarn(args) {
  let firstArg = args[0];
  if (
    firstArg !== null &&
    typeof firstArg === 'object' &&
    String(firstArg).indexOf('Error: Uncaught [') === 0
  ) {
    firstArg = String(firstArg);
  } else if (typeof firstArg !== 'string') {
    return false;
  }

  const maybeError = args[1];
  if (
    maybeError !== null &&
    typeof maybeError === 'object' &&
    maybeError.message === 'Simulated error coming from DevTools'
  ) {
    // Error from forcing an error boundary.
    return true;
  }

  return global._ignoredErrorOrWarningMessages.some(errorOrWarningMessage => {
    return firstArg.indexOf(errorOrWarningMessage) !== -1;
  });
}

Domain

Subdomains

Frequently Asked Questions

What does shouldIgnoreConsoleErrorOrWarn() do?
shouldIgnoreConsoleErrorOrWarn() is a function in the react codebase, defined in packages/react-devtools-shared/src/__tests__/setupTests.js.
Where is shouldIgnoreConsoleErrorOrWarn() defined?
shouldIgnoreConsoleErrorOrWarn() is defined in packages/react-devtools-shared/src/__tests__/setupTests.js at line 107.
What calls shouldIgnoreConsoleErrorOrWarn()?
shouldIgnoreConsoleErrorOrWarn() is called by 1 function(s): patchConsoleForTestingBeforeHookInstallation.

Analyze Your Own Codebase

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

Try Supermodel Free