Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jestUtils to mocks #5791

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Mar 14, 2024

Summary

Currently we don't reexport jest specific function (especially setUpTests) in our mock. This is due to fact that our recommended way of initializing Reanimated for testing is to do that in jest-setup.js file.

However, doing it just before the test suite (with beforeAll jest function) is just as good, if even not better considering test separation. This cannot be done if Reanimated is already mocked.

Test plan

Add Reanimated to a new RN app, mock Reanimated and see that setUpTests cannot be used in beforeAll. Do it using Reanimated built from this PR and see that it works.

@tjzel tjzel marked this pull request as ready for review March 15, 2024 11:49
@tjzel tjzel requested a review from piaskowyk March 15, 2024 11:49
@bartlomiejbloniarz bartlomiejbloniarz added this pull request to the merge queue Mar 15, 2024
Merged via the queue into main with commit 8f0f9bd Mar 15, 2024
8 checks passed
@bartlomiejbloniarz bartlomiejbloniarz deleted the @tjzel/mocks/reexport-jestUtils branch March 15, 2024 13:26
bartlomiejbloniarz pushed a commit that referenced this pull request Mar 15, 2024
## Summary

Currently we don't reexport jest specific function (especially
`setUpTests`) in our mock. This is due to fact that our recommended way
of initializing Reanimated for testing is to do that in `jest-setup.js`
file.

However, doing it just before the test suite (with `beforeAll` jest
function) is just as good, if even not better considering test
separation. This cannot be done if Reanimated is already mocked.

## Test plan

Add Reanimated to a new RN app, mock Reanimated and see that
`setUpTests` cannot be used in `beforeAll`. Do it using Reanimated built
from this PR and see that it works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants