componentStacks-test.js — react Source File
Architecture documentation for componentStacks-test.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 09c6b980_bbea_87ac_0bfe_8510d674fffb["componentStacks-test.js"] 30d8f92d_8eff_246b_42a3_051fddd910d2["utils"] 09c6b980_bbea_87ac_0bfe_8510d674fffb --> 30d8f92d_8eff_246b_42a3_051fddd910d2 style 09c6b980_bbea_87ac_0bfe_8510d674fffb 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.
*
* @flow
*/
import {
getVersionedRenderImplementation,
normalizeCodeLocInfo,
} from 'react-devtools-shared/src/__tests__/utils';
describe('component stack', () => {
let React;
let act;
let supportsOwnerStacks;
beforeEach(() => {
const utils = require('./utils');
act = utils.act;
React = require('react');
if (
React.version.startsWith('19') &&
React.version.includes('experimental')
) {
supportsOwnerStacks = true;
}
});
const {render} = getVersionedRenderImplementation();
// @reactVersion >=16.9
it('should log the current component stack along with an error or warning', () => {
const Grandparent = () => <Parent />;
const Parent = () => <Child />;
const Child = () => {
console.error('Test error.');
console.warn('Test warning.');
return null;
};
act(() => render(<Grandparent />));
expect(
global.consoleErrorMock.mock.calls[0].map(normalizeCodeLocInfo),
).toEqual([
'Test error.',
'\n in Child (at **)' +
'\n in Parent (at **)' +
'\n in Grandparent (at **)',
]);
expect(
global.consoleWarnMock.mock.calls[0].map(normalizeCodeLocInfo),
).toEqual([
'Test warning.',
'\n in Child (at **)' +
'\n in Parent (at **)' +
// ... (80 more lines)
Dependencies
- utils
Source
Frequently Asked Questions
What does componentStacks-test.js do?
componentStacks-test.js is a source file in the react codebase, written in javascript.
What does componentStacks-test.js depend on?
componentStacks-test.js imports 1 module(s): utils.
Where is componentStacks-test.js in the architecture?
componentStacks-test.js is located at packages/react-devtools-shared/src/__tests__/componentStacks-test.js (directory: packages/react-devtools-shared/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free