JestReact.js — react Source File
Architecture documentation for JestReact.js, a javascript file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6e8c1123_cee1_9b1d_49c3_11cbcce7cb2e["JestReact.js"] e1e1de60_2be4_0643_45fb_e2c306735427["ReactSymbols"] 6e8c1123_cee1_9b1d_49c3_11cbcce7cb2e --> e1e1de60_2be4_0643_45fb_e2c306735427 af78c51d_c7cb_3bf4_550f_f3fcc48f4f34["isArray"] 6e8c1123_cee1_9b1d_49c3_11cbcce7cb2e --> af78c51d_c7cb_3bf4_550f_f3fcc48f4f34 style 6e8c1123_cee1_9b1d_49c3_11cbcce7cb2e 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.
*/
import {REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE} from 'shared/ReactSymbols';
const {assertConsoleLogsCleared} = require('internal-test-utils/consoleMock');
import isArray from 'shared/isArray';
function captureAssertion(fn) {
// Trick to use a Jest matcher inside another Jest matcher. `fn` contains an
// assertion; if it throws, we capture the error and return it, so the stack
// trace presented to the user points to the original assertion in the
// test file.
try {
fn();
} catch (error) {
return {
pass: false,
message: () => error.message,
};
}
return {pass: true};
}
function assertYieldsWereCleared(root) {
const Scheduler = root._Scheduler;
const actualYields = Scheduler.unstable_clearLog();
if (actualYields.length !== 0) {
const error = Error(
'Log of yielded values is not empty. ' +
'Call expect(ReactTestRenderer).unstable_toHaveYielded(...) first.',
);
Error.captureStackTrace(error, assertYieldsWereCleared);
throw error;
}
assertConsoleLogsCleared();
}
function createJSXElementForTestComparison(type, props) {
if (__DEV__) {
const element = {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: null,
props: props,
_owner: null,
_store: __DEV__ ? {} : undefined,
};
Object.defineProperty(element, 'ref', {
enumerable: false,
value: null,
});
return element;
} else {
return {
$$typeof: REACT_ELEMENT_TYPE,
// ... (78 more lines)
Domain
Subdomains
Functions
Dependencies
- ReactSymbols
- isArray
Source
Frequently Asked Questions
What does JestReact.js do?
JestReact.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 JestReact.js?
JestReact.js defines 6 function(s): assertYieldsWereCleared, captureAssertion, createJSXElementForTestComparison, jsonChildToJSXChild, jsonChildrenToJSXChildren, unstable_toMatchRenderedOutput.
What does JestReact.js depend on?
JestReact.js imports 2 module(s): ReactSymbols, isArray.
Where is JestReact.js in the architecture?
JestReact.js is located at packages/jest-react/src/JestReact.js (domain: BabelCompiler, subdomain: Validation, directory: packages/jest-react/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free