Home / File/ parseConfigPragma-test.ts — react Source File

parseConfigPragma-test.ts — react Source File

Architecture documentation for parseConfigPragma-test.ts, a typescript file in the react codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  0a17785b_511f_2e7e_7dab_7cb034353a94["parseConfigPragma-test.ts"]
  6ec70299_8c45_d057_8deb_dd41bb1f7153["index.ts"]
  0a17785b_511f_2e7e_7dab_7cb034353a94 --> 6ec70299_8c45_d057_8deb_dd41bb1f7153
  2ed45bcd_6c82_3ccd_0e20_fa96b5111055[".."]
  0a17785b_511f_2e7e_7dab_7cb034353a94 --> 2ed45bcd_6c82_3ccd_0e20_fa96b5111055
  style 0a17785b_511f_2e7e_7dab_7cb034353a94 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 {parseConfigPragmaForTests, validateEnvironmentConfig} from '..';
import {defaultOptions} from '../Entrypoint';

describe('parseConfigPragmaForTests()', () => {
  it('parses flags in various forms', () => {
    const defaultConfig = validateEnvironmentConfig({});

    // Validate defaults first to make sure that the parser is getting the value from the pragma,
    // and not just missing it and getting the default value
    expect(defaultConfig.enableUseTypeAnnotations).toBe(false);
    expect(defaultConfig.validateNoSetStateInEffects).toBe(false);
    expect(defaultConfig.validateNoSetStateInRender).toBe(true);

    const config = parseConfigPragmaForTests(
      '@enableUseTypeAnnotations @validateNoSetStateInEffects:true @validateNoSetStateInRender:false',
      {compilationMode: defaultOptions.compilationMode},
    );
    expect(config).toEqual({
      ...defaultOptions,
      panicThreshold: 'all_errors',
      environment: {
        ...defaultOptions.environment,
        enableUseTypeAnnotations: true,
        validateNoSetStateInEffects: true,
        validateNoSetStateInRender: false,
        enableResetCacheOnSourceFileChanges: false,
      },
    });
  });
});

Dependencies

Frequently Asked Questions

What does parseConfigPragma-test.ts do?
parseConfigPragma-test.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain.
What does parseConfigPragma-test.ts depend on?
parseConfigPragma-test.ts imports 2 module(s): .., index.ts.
Where is parseConfigPragma-test.ts in the architecture?
parseConfigPragma-test.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/parseConfigPragma-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