mirror of
https://github.com/status-im/metro.git
synced 2025-01-28 03:44:54 +00:00
0349db8654
Summary: BREAKING CHANGE This change upgrades the React Native build pipeline from Babel 6 to Babel 7 If you use a `.babelrc` then you'll need to update it to Babel 7 (note that some plugins are no longer relevant, some plugins are automatically upgraded, and some will need some manual love). Note that you may also need to upgrade your dev env, tests etc, to make sure they work with Babel 7. Reviewed By: mjesun Differential Revision: D7591303 fbshipit-source-id: 29cef21f6466633a9c366d1f3c0d3cf874c714db
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) 2004-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails oncall+javascript_foundation
|
|
* @flow
|
|
* @format
|
|
*/
|
|
|
|
// Note: these tests were updated to snapshots
|
|
|
|
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
/*eslint-disable import/no-extraneous-dependencies*/
|
|
const {transformSync} = require('@babel/core');
|
|
const reactPlugin = require('../lib/index.js').default;
|
|
|
|
describe('finds React components', () => {
|
|
const fixturesDir = path.join(__dirname, '__fixtures__');
|
|
fs.readdirSync(fixturesDir).map(caseName => {
|
|
it(`should ${caseName.split('-').join(' ')}`, () => {
|
|
const fixtureDir = path.join(fixturesDir, caseName);
|
|
const input = fs.readFileSync(
|
|
path.join(fixtureDir, 'actual.js.es6'),
|
|
'utf8',
|
|
);
|
|
const config = fs.readFileSync(
|
|
path.join(fixtureDir, 'babel.json'),
|
|
'utf8',
|
|
);
|
|
const output = transformSync(input, {
|
|
babelrc: false,
|
|
plugins: [
|
|
[
|
|
reactPlugin,
|
|
// note: these originate from the .babelrc files from the real tests
|
|
JSON.parse(config),
|
|
],
|
|
],
|
|
}).code;
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
});
|
|
});
|