Home / File/ ReactProfilerComponent-test.internal.js — react Source File

ReactProfilerComponent-test.internal.js — react Source File

Architecture documentation for ReactProfilerComponent-test.internal.js, a javascript file in the react codebase.

File javascript BabelCompiler Validation 1 functions 1 classes

Entity Profile

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.
 *
 * @emails react-core
 */

'use strict';

let React;
let ReactDOMClient;
let ReactFeatureFlags;
let act;
let container;
let assertConsoleErrorDev;

function loadModules({
  enableProfilerTimer = true,
  enableProfilerCommitHooks = true,
  enableProfilerNestedUpdatePhase = true,
} = {}) {
  ReactFeatureFlags = require('shared/ReactFeatureFlags');

  ReactFeatureFlags.enableProfilerTimer = enableProfilerTimer;
  ReactFeatureFlags.enableProfilerCommitHooks = enableProfilerCommitHooks;
  ReactFeatureFlags.enableProfilerNestedUpdatePhase =
    enableProfilerNestedUpdatePhase;

  React = require('react');
  ReactDOMClient = require('react-dom/client');
  const InternalTestUtils = require('internal-test-utils');
  act = InternalTestUtils.act;
  assertConsoleErrorDev = InternalTestUtils.assertConsoleErrorDev;
}

describe('Profiler', () => {
  beforeEach(() => {
    container = document.createElement('div');
  });

  describe('works in profiling and non-profiling bundles', () => {
    [true, false].forEach(enableProfilerTimer => {
      describe(`enableProfilerTimer:${
        enableProfilerTimer ? 'enabled' : 'disabled'
      }`, () => {
        beforeEach(() => {
          jest.resetModules();

          loadModules({enableProfilerTimer});
        });

        // This will throw in production too,
        // But the test is only interested in verifying the DEV error message.
        if (__DEV__ && enableProfilerTimer) {
          it('should warn if required params are missing', async () => {
            const root = ReactDOMClient.createRoot(container);
            await act(() => {
              root.render(<React.Profiler />);
// ... (70 more lines)

Domain

Subdomains

Functions

Classes

Frequently Asked Questions

What does ReactProfilerComponent-test.internal.js do?
ReactProfilerComponent-test.internal.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactProfilerComponent-test.internal.js?
ReactProfilerComponent-test.internal.js defines 1 function(s): loadModules.
Where is ReactProfilerComponent-test.internal.js in the architecture?
ReactProfilerComponent-test.internal.js is located at packages/react/src/__tests__/ReactProfilerComponent-test.internal.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free