mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix public-api-test "expected parse error" assertion (#43378)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43378 ## Overview I noticed while running this test, that there's an existing `console.error` to remove a file from the `FILES_WITH_KNOWN_ERRORS` list, but the tests pass despite the error. This happens because the `console.error` throws to fail the test, but this `console.error` is inside a try/catch, so the error is swallowed. This diff moves the check to a finally, which fails the test. I also fixed the `FILES_WITH_KNOWN_ERRORS` list. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D54587062 fbshipit-source-id: c46e98326ef6654452871337364d7e66ff204e2c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cfa39c0a69
commit
7bb204a160
@@ -87,19 +87,22 @@ describe('public API', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
let success = false;
|
||||
try {
|
||||
expect(await translateFlowToExportedAPI(source)).toMatchSnapshot();
|
||||
|
||||
if (FILES_WITH_KNOWN_ERRORS.has(file)) {
|
||||
success = true;
|
||||
} catch (e) {
|
||||
if (!FILES_WITH_KNOWN_ERRORS.has(file)) {
|
||||
console.error('Unable to parse file:', file, '\n' + e);
|
||||
}
|
||||
} finally {
|
||||
if (success && FILES_WITH_KNOWN_ERRORS.has(file)) {
|
||||
console.error(
|
||||
'Expected parse error, please remove file exclude from FILES_WITH_KNOWN_ERRORS:',
|
||||
file,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!FILES_WITH_KNOWN_ERRORS.has(file)) {
|
||||
console.error('Unable to parse file:', file, '\n' + e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
expect('UNTYPED MODULE').toMatchSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user