global() — react Function Reference
Architecture documentation for the global() function in setupTests.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 23bece51_b879_d1c9_8c4d_6e5c1d112231["global()"] 7a8b988c_a832_ec08_c36e_22d30113be12["setupTests.js"] 23bece51_b879_d1c9_8c4d_6e5c1d112231 -->|defined in| 7a8b988c_a832_ec08_c36e_22d30113be12 2392ccee_84a6_6928_1fd0_6889e595e724["expectTestToFail()"] 23bece51_b879_d1c9_8c4d_6e5c1d112231 -->|calls| 2392ccee_84a6_6928_1fd0_6889e595e724 style 23bece51_b879_d1c9_8c4d_6e5c1d112231 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/__tests__/setupTests.js lines 60–79
global._test_gate = (gateFn, testName, callback) => {
let shouldPass;
try {
const flags = getTestFlags();
shouldPass = gateFn(flags);
} catch (e) {
test(testName, () => {
throw e;
});
return;
}
if (shouldPass) {
test(testName, callback);
} else {
const error = new Error(gatedErrorMessage);
Error.captureStackTrace(error, global._test_gate);
test(`[GATED, SHOULD FAIL] ${testName}`, () =>
expectTestToFail(callback, error));
}
};
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does global() do?
global() is a function in the react codebase, defined in packages/react-devtools-shared/src/__tests__/setupTests.js.
Where is global() defined?
global() is defined in packages/react-devtools-shared/src/__tests__/setupTests.js at line 60.
What does global() call?
global() calls 1 function(s): expectTestToFail.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free