/
githubmirror
/
react-native
Обзор
Документация
Войти
/
githubmirror
/
react-native
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/babel-plugin-codegen/__tests__/index-test.js
53 строки
1 KB
Tim Yung
RN: Flowify `packages/react-native-codegen` (#51781)
04 июн 2025, 22:03
04 июн 2025, 22:03
404f3eb
Код
Авторство
О чём код?
/** * 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. * * @flow strict-local * @format */ import failures from '../__test_fixtures__/failures.js'; import fixtures from '../__test_fixtures__/fixtures.js'; import {transformSync} from '@babel/core'; const transform = (fixture /*: string */, filename /*: string */) => transformSync(fixture, { babelrc: false, browserslistConfigFile: false, cwd: '/', filename, highlightCode: false, plugins: [ // $FlowFixMe[untyped-import] require('@babel/plugin-syntax-flow'), // $FlowFixMe[untyped-import] require('../index'), ], }).code; describe('Babel plugin inline view configs', () => { Object.keys(fixtures) .sort() .forEach(fixtureName => { it(`can inline config for ${fixtureName}`, () => { expect(transform(fixtures[fixtureName], fixtureName)).toMatchSnapshot(); }); }); Object.keys(failures) .sort() .forEach(fixtureName => { it(`fails on inline config for ${fixtureName}`, () => { expect(() => { try { transform(failures[fixtureName], fixtureName); } catch (err) { err.message = err.message.replace(/^[A-z]:\\/g, '/'); // Ensure platform consistent snapshots. throw err; } }).toThrowErrorMatchingSnapshot(); }); }); });