envConfig-test.ts — react Source File
Architecture documentation for envConfig-test.ts, a typescript file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 585d72b8_7ab7_ceec_3d68_357235a3a3d2["envConfig-test.ts"] 0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"] 585d72b8_7ab7_ceec_3d68_357235a3a3d2 --> 0423f759_97e0_9101_4634_ed555abc5ca9 2ed45bcd_6c82_3ccd_0e20_fa96b5111055[".."] 585d72b8_7ab7_ceec_3d68_357235a3a3d2 --> 2ed45bcd_6c82_3ccd_0e20_fa96b5111055 style 585d72b8_7ab7_ceec_3d68_357235a3a3d2 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.
*/
import {Effect, validateEnvironmentConfig} from '..';
import {ValueKind} from '../HIR';
describe('parseConfigPragma()', () => {
it('passing null throws', () => {
expect(() => validateEnvironmentConfig(null as any)).toThrow();
});
// tests that the error message remains useful
it('passing incorrect value throws', () => {
expect(() => {
validateEnvironmentConfig({
validateHooksUsage: 1,
} as any);
}).toThrowErrorMatchingInlineSnapshot(
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: Invalid input: expected boolean, received number at "validateHooksUsage"."`,
);
});
it('effect autodeps config must have at least 1 required argument', () => {
expect(() => {
validateEnvironmentConfig({
inferEffectDependencies: [
{
function: {
source: 'react',
importSpecifierName: 'useEffect',
},
autodepsIndex: 0,
},
],
} as any);
}).toThrowErrorMatchingInlineSnapshot(
`"Error: Could not validate environment config. Update React Compiler config to fix the error. Validation error: AutodepsIndex must be > 0 at "inferEffectDependencies[0].autodepsIndex"."`,
);
});
it('can parse stringy enums', () => {
const stringyHook = {
effectKind: 'freeze',
valueKind: 'frozen',
};
const env = {
customHooks: new Map([['useFoo', stringyHook]]),
};
const validatedEnv = validateEnvironmentConfig(env as any);
const validatedHook = validatedEnv.customHooks.get('useFoo');
expect(validatedHook?.effectKind).toBe(Effect.Freeze);
expect(validatedHook?.valueKind).toBe(ValueKind.Frozen);
});
});
Domain
Dependencies
- ..
- index.ts
Source
Frequently Asked Questions
What does envConfig-test.ts do?
envConfig-test.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain.
What does envConfig-test.ts depend on?
envConfig-test.ts imports 2 module(s): .., index.ts.
Where is envConfig-test.ts in the architecture?
envConfig-test.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/envConfig-test.ts (domain: TestingUtilities, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free