Home / File/ profilingHostRoot-test.js — react Source File

profilingHostRoot-test.js — react Source File

Architecture documentation for profilingHostRoot-test.js, a javascript file in the react codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  fcce1197_56db_99f4_9c27_325109a12f25["profilingHostRoot-test.js"]
  7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4["utils.js"]
  fcce1197_56db_99f4_9c27_325109a12f25 --> 7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4
  026f470e_4718_4a16_f9eb_8e2406332f5a["getLegacyRenderImplementation"]
  fcce1197_56db_99f4_9c27_325109a12f25 --> 026f470e_4718_4a16_f9eb_8e2406332f5a
  a5efc5c7_2c74_9c94_1e30_396b32c15d53["getModernRenderImplementation"]
  fcce1197_56db_99f4_9c27_325109a12f25 --> a5efc5c7_2c74_9c94_1e30_396b32c15d53
  style fcce1197_56db_99f4_9c27_325109a12f25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import {
  getLegacyRenderImplementation,
  getModernRenderImplementation,
} from './utils';

describe('profiling HostRoot', () => {
  let React;
  let Scheduler;
  let store;
  let utils;
  let getEffectDurations;
  let effectDurations;
  let passiveEffectDurations;

  beforeEach(() => {
    utils = require('./utils');
    utils.beforeEachProfiling();

    getEffectDurations = require('../backend/utils').getEffectDurations;

    store = global.store;

    React = require('react');
    Scheduler = require('scheduler');

    effectDurations = [];
    passiveEffectDurations = [];

    // This is the DevTools hook installed by the env.beforEach()
    // The hook is installed as a read-only property on the window,
    // so for our test purposes we can just override the commit hook.
    const hook = global.__REACT_DEVTOOLS_GLOBAL_HOOK__;
    hook.onPostCommitFiberRoot = function onPostCommitFiberRoot(
      rendererID,
      root,
    ) {
      const {effectDuration, passiveEffectDuration} = getEffectDurations(root);
      effectDurations.push(effectDuration);
      passiveEffectDurations.push(passiveEffectDuration);
    };
  });

  const {render: legacyRender} = getLegacyRenderImplementation();
  const {render: modernRender} = getModernRenderImplementation();

  // @reactVersion >= 18.0
  // @reactVersion <= 18.2
  it('should expose passive and layout effect durations for render()', () => {
    function App() {
      React.useEffect(() => {
        Scheduler.unstable_advanceTime(10);
// ... (88 more lines)

Domain

Frequently Asked Questions

What does profilingHostRoot-test.js do?
profilingHostRoot-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does profilingHostRoot-test.js depend on?
profilingHostRoot-test.js imports 3 module(s): getLegacyRenderImplementation, getModernRenderImplementation, utils.js.
Where is profilingHostRoot-test.js in the architecture?
profilingHostRoot-test.js is located at packages/react-devtools-shared/src/__tests__/profilingHostRoot-test.js (domain: BabelCompiler, directory: packages/react-devtools-shared/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free