Skip to content

Conversation

@AntoineDoubovetzky
Copy link

Summary

#34933 has been merged just after I pushed a new commit to the branch to improve tests of assertGenericTypeAnnotationHasExactlyOneTypeParameter function, but the last commit was not imported to the internal repository.

The assertGenericTypeAnnotationHasExactlyOneTypeParameter can throw different types of Error, and I believe that .toThrow(Error) is not specific enough. So I replaced it with toThrowErrorMatchingInlineSnapshot().

Changelog

[Internal] [Changed] - Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests in parsers-commons

Test Plan

Some test cases were ok because the assertGenericTypeAnnotationHasExactlyOneTypeParameter function threw an Error, but for the wrong reason. I've made sure that the error displayed in the inline snapshot is the one we expect.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 11, 2022
const flowTypeAnnotation = {
typeParameters: {
type: 'TypeParameterInstantiation',
type: 'wrongType',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case was ok because an Error was thrown even though the type had the correct value.
It was the fact that params was missing that caused an Error to be thrown.

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AntoineDoubovetzky, thanks a lot for this extra PR that shows how much you care. 🥰

Can you fix the linting error? It looks like there is an unused variable in the code!

@analysis-bot
Copy link

analysis-bot commented Oct 11, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,768,287 -274
android hermes armeabi-v7a 7,169,380 -278
android hermes x86 8,081,549 -281
android hermes x86_64 8,053,115 -278
android jsc arm64-v8a 9,629,465 -248
android jsc armeabi-v7a 8,393,871 -249
android jsc x86 9,578,928 -236
android jsc x86_64 10,171,967 -235

Base commit: f353119
Branch: main

@analysis-bot
Copy link

analysis-bot commented Oct 11, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: f353119
Branch: main

@AntoineDoubovetzky
Copy link
Author

@cipolleschi Sorry I didn't notice the unused import. I removed it!

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this! It looks good!

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @AntoineDoubovetzky in 790f40c.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 19, 2022
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…acebook#34942)

Summary:
facebook#34933 has been merged just after I pushed a new commit to the branch to improve tests of `assertGenericTypeAnnotationHasExactlyOneTypeParameter` function, but the last commit was not imported to the internal repository.

The `assertGenericTypeAnnotationHasExactlyOneTypeParameter` can throw different types of Error, and I believe that `.toThrow(Error)` is not specific enough. So I replaced it with `toThrowErrorMatchingInlineSnapshot()`.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests in parsers-commons

Pull Request resolved: facebook#34942

Test Plan: Some test cases were ok because the assertGenericTypeAnnotationHasExactlyOneTypeParameter function threw an Error, but for the wrong reason. I've made sure that the error displayed in the inline snapshot is the one we expect.

Reviewed By: cortinico

Differential Revision: D40384993

Pulled By: cipolleschi

fbshipit-source-id: aaa943be1e808af2c5131f7d06baf24bc3bffa31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. hacktoberfest-accepted Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants