ReactDOMServerIntegrationTestUtils.js — react Source File
Architecture documentation for ReactDOMServerIntegrationTestUtils.js, a javascript file in the react codebase.
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';
const stream = require('stream');
const shouldIgnoreConsoleError = require('internal-test-utils/shouldIgnoreConsoleError');
module.exports = function (initModules) {
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;
let act;
function resetModules() {
({ReactDOM, ReactDOMClient, ReactDOMServer} = initModules());
act = require('internal-test-utils').act;
}
function shouldUseDocument(reactElement) {
// Used for whole document tests.
return reactElement && reactElement.type === 'html';
}
function getContainerFromMarkup(reactElement, markup) {
if (shouldUseDocument(reactElement)) {
const doc = document.implementation.createHTMLDocument('');
doc.open();
doc.write(
markup ||
'<!doctype html><html><meta charset=utf-8><title>test doc</title>',
);
doc.close();
return doc;
} else {
const container = document.createElement('div');
container.innerHTML = markup;
return container;
}
}
// Helper functions for rendering tests
// ====================================
// promisified version of ReactDOM.render()
async function asyncReactDOMRender(reactElement, domElement, forceHydrate) {
if (forceHydrate) {
await act(() => {
ReactDOMClient.hydrateRoot(domElement, reactElement, {
onRecoverableError(e) {
if (
e.message.startsWith(
'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
)
// ... (349 more lines)
Domain
Subdomains
Functions
Classes
Source
Frequently Asked Questions
What does ReactDOMServerIntegrationTestUtils.js do?
ReactDOMServerIntegrationTestUtils.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 ReactDOMServerIntegrationTestUtils.js?
ReactDOMServerIntegrationTestUtils.js defines 1 function(s): module.
Where is ReactDOMServerIntegrationTestUtils.js in the architecture?
ReactDOMServerIntegrationTestUtils.js is located at packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/__tests__/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free