MCPcopy
hub / github.com/facebook/react / loadModules

Function loadModules

packages/react/src/__tests__/ReactProfiler-test.internal.js:24–60  ·  view source on GitHub ↗
({
  enableProfilerTimer = true,
  enableProfilerCommitHooks = true,
  enableProfilerNestedUpdatePhase = true,
} = {})

Source from the content-addressed store, hash-verified

22let waitForThrow;
23
24function loadModules({
25 enableProfilerTimer = true,
26 enableProfilerCommitHooks = true,
27 enableProfilerNestedUpdatePhase = true,
28} = {}) {
29 ReactFeatureFlags = require('shared/ReactFeatureFlags');
30
31 ReactFeatureFlags.enableProfilerTimer = enableProfilerTimer;
32 ReactFeatureFlags.enableProfilerCommitHooks = enableProfilerCommitHooks;
33 ReactFeatureFlags.enableProfilerNestedUpdatePhase =
34 enableProfilerNestedUpdatePhase;
35
36 React = require('react');
37 Scheduler = require('scheduler');
38 ReactNoop = require('react-noop-renderer');
39 const InternalTestUtils = require('internal-test-utils');
40 act = InternalTestUtils.act;
41 assertLog = InternalTestUtils.assertLog;
42 waitFor = InternalTestUtils.waitFor;
43 waitForAll = InternalTestUtils.waitForAll;
44 waitForThrow = InternalTestUtils.waitForThrow;
45
46 AdvanceTime = class extends React.Component {
47 static defaultProps = {
48 byAmount: 10,
49 shouldComponentUpdate: true,
50 };
51 shouldComponentUpdate(nextProps) {
52 return nextProps.shouldComponentUpdate;
53 }
54 render() {
55 // Simulate time passing when this component is rendered
56 Scheduler.unstable_advanceTime(this.props.byAmount);
57 return this.props.children || null;
58 }
59 };
60}
61
62describe(`onRender`, () => {
63 beforeEach(() => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected