ReactHooksInspectionIntegration-test.js — react Source File
Architecture documentation for ReactHooksInspectionIntegration-test.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
* @jest-environment node
*/
'use strict';
let React;
let ReactTestRenderer;
let ReactDebugTools;
let act;
let useMemoCache;
function normalizeSourceLoc(tree) {
tree.forEach(node => {
if (node.hookSource) {
node.hookSource.fileName = '**';
node.hookSource.lineNumber = 0;
node.hookSource.columnNumber = 0;
}
normalizeSourceLoc(node.subHooks);
});
return tree;
}
describe('ReactHooksInspectionIntegration', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactTestRenderer = require('react-test-renderer');
({act} = require('internal-test-utils'));
ReactDebugTools = require('react-debug-tools');
useMemoCache = require('react/compiler-runtime').c;
});
it('should inspect the current state of useState hooks', async () => {
const useState = React.useState;
function Foo(props) {
const [state1, setState1] = useState('hello');
const [state2, setState2] = useState('world');
return (
<div onMouseDown={setState1} onMouseUp={setState2}>
{state1} {state2}
</div>
);
}
let renderer;
await act(() => {
renderer = ReactTestRenderer.create(<Foo prop="prop" />, {
unstable_isConcurrent: true,
});
});
let childFiber = renderer.root.findByType(Foo)._currentFiber();
let tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
// ... (2602 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does ReactHooksInspectionIntegration-test.js do?
ReactHooksInspectionIntegration-test.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 ReactHooksInspectionIntegration-test.js?
ReactHooksInspectionIntegration-test.js defines 1 function(s): normalizeSourceLoc.
Where is ReactHooksInspectionIntegration-test.js in the architecture?
ReactHooksInspectionIntegration-test.js is located at packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-debug-tools/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free