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

profilerStore-test.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  82290287_534e_283e_5ec8_29ad7759e0a2["profilerStore-test.js"]
  7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4["utils.js"]
  82290287_534e_283e_5ec8_29ad7759e0a2 --> 7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4
  baf70b0e_4867_b3ed_962a_e5c9ae820fef["store"]
  82290287_534e_283e_5ec8_29ad7759e0a2 --> baf70b0e_4867_b3ed_962a_e5c9ae820fef
  style 82290287_534e_283e_5ec8_29ad7759e0a2 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 type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('ProfilerStore', () => {
  let React;
  let store: Store;
  let utils;

  beforeEach(() => {
    global.IS_REACT_ACT_ENVIRONMENT = true;

    utils = require('./utils');
    utils.beforeEachProfiling();

    store = global.store;
    store.collapseNodesByDefault = false;
    store.recordChangeDescriptions = true;

    React = require('react');
  });

  const {render, unmount} = getVersionedRenderImplementation();
  const {render: renderOther, unmount: unmountOther} =
    getVersionedRenderImplementation();

  // @reactVersion >= 16.9
  it('should not remove profiling data when roots are unmounted', async () => {
    const Parent = ({count}) =>
      new Array(count)
        .fill(true)
        .map((_, index) => <Child key={index} duration={index} />);
    const Child = () => <div>Hi!</div>;

    utils.act(() => {
      render(<Parent key="A" count={3} />);
      renderOther(<Parent key="B" count={2} />);
    });

    utils.act(() => store.profilerStore.startProfiling());

    utils.act(() => {
      render(<Parent key="A" count={4} />);
      renderOther(<Parent key="B" count={1} />);
    });

    utils.act(() => store.profilerStore.stopProfiling());

    const rootA = store.roots[0];
    const rootB = store.roots[1];

// ... (177 more lines)

Domain

Dependencies

Frequently Asked Questions

What does profilerStore-test.js do?
profilerStore-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does profilerStore-test.js depend on?
profilerStore-test.js imports 2 module(s): store, utils.js.
Where is profilerStore-test.js in the architecture?
profilerStore-test.js is located at packages/react-devtools-shared/src/__tests__/profilerStore-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