Home / File/ transform-lazy-jsx-import-test.js — react Source File

transform-lazy-jsx-import-test.js — react Source File

Architecture documentation for transform-lazy-jsx-import-test.js, a javascript file in the react codebase.

Entity Profile

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.
 */
'use strict';

describe('transform-lazy-jsx-import', () => {
  it('should use the mocked version of the "react" runtime in jsx', () => {
    jest.resetModules();
    const mock = jest.fn(type => 'fakejsx: ' + type);
    if (__DEV__) {
      jest.mock('react/jsx-dev-runtime', () => {
        return {
          jsxDEV: mock,
        };
      });
    } else {
      jest.mock('react/jsx-runtime', () => ({
        jsx: mock,
        jsxs: mock,
      }));
    }
    // eslint-disable-next-line react/react-in-jsx-scope
    const x = <div />;
    expect(x).toBe('fakejsx: div');
    expect(mock).toHaveBeenCalledTimes(1);
  });
});

Frequently Asked Questions

What does transform-lazy-jsx-import-test.js do?
transform-lazy-jsx-import-test.js is a source file in the react codebase, written in javascript.
Where is transform-lazy-jsx-import-test.js in the architecture?
transform-lazy-jsx-import-test.js is located at scripts/babel/__tests__/transform-lazy-jsx-import-test.js (directory: scripts/babel/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free