Home / Function/ global() — react Function Reference

global() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1b4722bc_0195_5bfc_91e0_9ef7aada5bd1["global()"]
  43a9dcfc_2c39_11bb_bfaa_2fb3177e90f7["setupTests.js"]
  1b4722bc_0195_5bfc_91e0_9ef7aada5bd1 -->|defined in| 43a9dcfc_2c39_11bb_bfaa_2fb3177e90f7
  d3922b0c_1bd8_17c8_397e_23209a1d814d["coerceGateConditionToFunction()"]
  1b4722bc_0195_5bfc_91e0_9ef7aada5bd1 -->|calls| d3922b0c_1bd8_17c8_397e_23209a1d814d
  8d1670a7_df7f_f9bd_de98_72e624547927["captureStackTrace()"]
  1b4722bc_0195_5bfc_91e0_9ef7aada5bd1 -->|calls| 8d1670a7_df7f_f9bd_de98_72e624547927
  19c75db6_0691_dfe4_cfbd_1d5f641f5c16["expectTestToFail()"]
  1b4722bc_0195_5bfc_91e0_9ef7aada5bd1 -->|calls| 19c75db6_0691_dfe4_cfbd_1d5f641f5c16
  style 1b4722bc_0195_5bfc_91e0_9ef7aada5bd1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/jest/setupTests.js lines 30–36

  global.spyOn = function () {
    throw new Error(
      'Do not use spyOn(). ' +
        'It can accidentally hide unexpected errors in production builds. ' +
        'Use spyOnDev(), spyOnProd(), or spyOnDevAndProd() instead.'
    );
  };

Domain

Subdomains

Frequently Asked Questions

What does global() do?
global() is a function in the react codebase, defined in scripts/jest/setupTests.js.
Where is global() defined?
global() is defined in scripts/jest/setupTests.js at line 30.
What does global() call?
global() calls 3 function(s): captureStackTrace, coerceGateConditionToFunction, expectTestToFail.

Analyze Your Own Codebase

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

Try Supermodel Free