/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
compiler/packages/babel-plugin-react-compiler/src/__tests__/parseConfigPragma-test.ts
37 строк
1 KB
Joseph Savona
[compiler] Validate against setState in all effect types (#33753)
25 июл 2025, 01:36
Не верифицирован
25 июл 2025, 01:36
6f4294a
Код
Авторство
О чём код?
/** * 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, }, }); }); });