Skip unsupported Flow syntax in public-api-test (#42667)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42667

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D53091943

fbshipit-source-id: afbde589d2fce705f6907de929f291e7862c4258
This commit is contained in:
Alex Hunt
2024-01-29 06:47:49 -08:00
committed by Facebook GitHub Bot
parent 3869ae4d80
commit 273ce836a1
2 changed files with 9 additions and 1 deletions
@@ -1488,6 +1488,8 @@ declare export default typeof NativeFileReaderModule;
"
`;
exports[`public API should not change unintentionally Libraries/Blob/URL.js 1`] = `"UNTYPED MODULE (unsupported-syntax suppression)"`;
exports[`public API should not change unintentionally Libraries/BugReporting/BugReporting.js 1`] = `
"type ExtraData = { [key: string]: string, ... };
type SourceCallback = () => string;
@@ -31,7 +31,6 @@ const IGNORE_PATTERNS = [
// review your changes before adding new entries.
const FILES_WITH_KNOWN_ERRORS = new Set([
'Libraries/Blob/FileReader.js',
'Libraries/Blob/URL.js',
'Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js',
'Libraries/Components/Keyboard/KeyboardAvoidingView.js',
'Libraries/Components/RefreshControl/RefreshControl.js',
@@ -82,6 +81,13 @@ describe('public API', () => {
const source = await fs.readFile(path.join(PACKAGE_ROOT, file), 'utf-8');
if (/@flow/.test(source)) {
if (source.includes('// $FlowFixMe[unsupported-syntax]')) {
expect(
'UNTYPED MODULE (unsupported-syntax suppression)',
).toMatchSnapshot();
return;
}
try {
expect(await translateFlowToExportedAPI(source)).toMatchSnapshot();