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

ReactTestRenderer-test.internal.js — react Source File

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

File javascript BabelCompiler Validation 1 functions 9 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
 * @jest-environment node
 */

'use strict';

const ReactFeatureFlags = require('shared/ReactFeatureFlags');
const React = require('react');
const ReactTestRenderer = require('react-test-renderer');
const {format: prettyFormat} = require('pretty-format');
const InternalTestUtils = require('internal-test-utils');
const waitForAll = InternalTestUtils.waitForAll;
const act = InternalTestUtils.act;
const Reconciler = require('react-reconciler/src/ReactFiberReconciler');
const {
  ConcurrentRoot,
  LegacyRoot,
} = require('react-reconciler/src/ReactRootTags');

// Isolate noop renderer
jest.resetModules();
const ReactNoop = require('react-noop-renderer');

// Kind of hacky, but we nullify all the instances to test the tree structure
// with jasmine's deep equality function, and test the instances separate. We
// also delete children props because testing them is more annoying and not
// really important to verify.
function cleanNodeOrArray(node) {
  if (!node) {
    return;
  }
  if (Array.isArray(node)) {
    node.forEach(cleanNodeOrArray);
    return;
  }
  if (node && node.instance) {
    node.instance = null;
  }
  if (node && node.props && node.props.children) {
    const {children, ...props} = node.props;
    node.props = props;
  }
  if (Array.isArray(node.rendered)) {
    node.rendered.forEach(cleanNodeOrArray);
  } else if (typeof node.rendered === 'object') {
    cleanNodeOrArray(node.rendered);
  }
}

describe('ReactTestRenderer', () => {
  beforeEach(() => {
    jest.resetModules();
    ReactFeatureFlags.enableReactTestRendererWarning = false;
  });
// ... (1181 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does ReactTestRenderer-test.internal.js do?
ReactTestRenderer-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 ReactTestRenderer-test.internal.js?
ReactTestRenderer-test.internal.js defines 1 function(s): cleanNodeOrArray.
Where is ReactTestRenderer-test.internal.js in the architecture?
ReactTestRenderer-test.internal.js is located at packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-test-renderer/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free