ReactJSXTransformIntegration-test.js — react Source File
Architecture documentation for ReactJSXTransformIntegration-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
*/
'use strict';
let React;
let ReactDOMClient;
let act;
let assertConsoleErrorDev;
// TODO: Historically this module was used to confirm that the JSX transform
// produces the correct output. However, most users (and indeed our own test
// suite) use a tool like Babel or TypeScript to transform JSX; unlike the
// runtime, the transform is not part of React itself. So this is really just an
// integration suite for the Babel transform. We might consider deleting it. We
// should prefer to test the JSX runtime directly, in ReactCreateElement-test
// and ReactJsxRuntime-test. In the meantime, there's lots of overlap between
// those modules and this one.
describe('ReactJSXTransformIntegration', () => {
let Component;
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOMClient = require('react-dom/client');
({act, assertConsoleErrorDev} = require('internal-test-utils'));
Component = class extends React.Component {
render() {
return <div />;
}
};
});
it('sanity check: test environment is configured to compile JSX to the jsx() runtime', async () => {
function App() {
return <div />;
}
const source = App.toString();
if (__DEV__) {
expect(source).toContain('jsxDEV(');
} else {
expect(source).toContain('jsx(');
}
expect(source).not.toContain('React.createElement');
});
it('returns a complete element according to spec', () => {
const element = <Component />;
expect(element.type).toBe(Component);
expect(element.key).toBe(null);
expect(element.ref).toBe(null);
const expectation = {};
// ... (199 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does ReactJSXTransformIntegration-test.js do?
ReactJSXTransformIntegration-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is ReactJSXTransformIntegration-test.js in the architecture?
ReactJSXTransformIntegration-test.js is located at packages/react/src/__tests__/ReactJSXTransformIntegration-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free