ReactFreshBabelPlugin-test.js — react Source File
Architecture documentation for ReactFreshBabelPlugin-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.
*/
'use strict';
const babel = require('@babel/core');
const {wrap} = require('jest-snapshot-serializer-raw');
const freshPlugin = require('react-refresh/babel');
function transform(input, options = {}) {
return wrap(
babel.transform(input, {
babelrc: false,
configFile: false,
envName: options.envName,
plugins: [
'@babel/syntax-jsx',
'@babel/syntax-dynamic-import',
[
freshPlugin,
{
skipEnvCheck:
options.skipEnvCheck === undefined ? true : options.skipEnvCheck,
// To simplify debugging tests:
emitFullSignatures: true,
...options.freshOptions,
},
],
...(options.plugins || []),
],
}).code,
);
}
describe('ReactFreshBabelPlugin', () => {
it('registers top-level function declarations', () => {
// Hello and Bar should be registered, handleClick shouldn't.
expect(
transform(`
function Hello() {
function handleClick() {}
return <h1 onClick={handleClick}>Hi</h1>;
}
function Bar() {
return <Hello />;
}
`),
).toMatchSnapshot();
});
it('registers top-level exported function declarations', () => {
expect(
transform(`
export function Hello() {
function handleClick() {}
// ... (505 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does ReactFreshBabelPlugin-test.js do?
ReactFreshBabelPlugin-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 ReactFreshBabelPlugin-test.js?
ReactFreshBabelPlugin-test.js defines 1 function(s): transform.
Where is ReactFreshBabelPlugin-test.js in the architecture?
ReactFreshBabelPlugin-test.js is located at packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-refresh/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free