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

ReactIsomorphicAct-test.js — react Source File

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

Entity Profile

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.
 *
 * @jest-environment node
 */

// sanity tests for act()

let React;
let ReactNoop;
let act;
let use;
let Suspense;
let DiscreteEventPriority;
let startTransition;
let waitForMicrotasks;
let Scheduler;
let assertLog;

describe('isomorphic act()', () => {
  beforeEach(() => {
    React = require('react');
    Scheduler = require('scheduler');

    ReactNoop = require('react-noop-renderer');
    DiscreteEventPriority =
      require('react-reconciler/constants').DiscreteEventPriority;
    act = React.act;
    use = React.use;
    Suspense = React.Suspense;
    startTransition = React.startTransition;

    waitForMicrotasks = require('internal-test-utils').waitForMicrotasks;
    assertLog = require('internal-test-utils').assertLog;
  });

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

  afterEach(() => {
    jest.restoreAllMocks();
  });

  function Text({text}) {
    Scheduler.log(text);
    return text;
  }

  it('behavior in production', () => {
    if (!__DEV__) {
      if (gate('fb')) {
        expect(() => act(() => {})).toThrow(
          'act(...) is not supported in production builds of React',
        );
      } else {
        expect(React).not.toHaveProperty('act');
// ... (303 more lines)

Frequently Asked Questions

What does ReactIsomorphicAct-test.js do?
ReactIsomorphicAct-test.js is a source file in the react codebase, written in javascript.
Where is ReactIsomorphicAct-test.js in the architecture?
ReactIsomorphicAct-test.js is located at packages/react-reconciler/src/__tests__/ReactIsomorphicAct-test.js (directory: packages/react-reconciler/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free