mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Updates the combine-js-to-schema to expose a cli and combine all passed files into a single schema output Note: as far as I could tell, there isn't a way for buck to pass a glob of directories, so instead of accepting a dir and crawling it, this update accepts a list of files and combines them. Which makes sense, since buck is good at crawling already Reviewed By: TheSavior Differential Revision: D14007193 fbshipit-source-id: dbc209bb8d1cadd381269e9f70dc71a90f77878e
49 lines
968 B
JavaScript
49 lines
968 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails oncall+react_native
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
import combine from '../combine-js-to-schema';
|
|
|
|
jest.mock(
|
|
'/test/module/SchemaOne',
|
|
() => ({
|
|
modules: {
|
|
ComponentOne: {
|
|
foo: 'baz',
|
|
},
|
|
},
|
|
}),
|
|
{virtual: true},
|
|
);
|
|
|
|
jest.mock(
|
|
'/test/module/SchemaTwo',
|
|
() => ({
|
|
modules: {
|
|
ComponentTwo: {
|
|
foo: 'bar',
|
|
},
|
|
},
|
|
}),
|
|
{virtual: true},
|
|
);
|
|
|
|
test('should combine files', () => {
|
|
const files = ['/test/module/SchemaOne', '/test/module/SchemaTwo'];
|
|
expect(combine(files)).toMatchSnapshot();
|
|
});
|
|
|
|
test('should throw for failed require', () => {
|
|
const files = ['/test/module/does/not/exist'];
|
|
expect(() => combine(files)).toThrow(
|
|
"Can't require file at /test/module/does/not/exist",
|
|
);
|
|
});
|