MCPcopy
hub / github.com/testing-library/react-testing-library / getGlobalThis

Function getGlobalThis

src/act-compat.js:7–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5 typeof React.act === 'function' ? React.act : DeprecatedReactTestUtils.act
6
7function getGlobalThis() {
8 /* istanbul ignore else */
9 if (typeof globalThis !== 'undefined') {
10 return globalThis
11 }
12 /* istanbul ignore next */
13 if (typeof self !== 'undefined') {
14 return self
15 }
16 /* istanbul ignore next */
17 if (typeof window !== 'undefined') {
18 return window
19 }
20 /* istanbul ignore next */
21 if (typeof global !== 'undefined') {
22 return global
23 }
24 /* istanbul ignore next */
25 throw new Error('unable to locate global object')
26}
27
28function setIsReactActEnvironment(isReactActEnvironment) {
29 getGlobalThis().IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment

Callers 2

setIsReactActEnvironmentFunction · 0.85
getIsReactActEnvironmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…