Skip to content

Add jestUtils to mocks#5791

Merged
bartlomiejbloniarz merged 1 commit intomainfrom
@tjzel/mocks/reexport-jestUtils
Mar 15, 2024
Merged

Add jestUtils to mocks#5791
bartlomiejbloniarz merged 1 commit intomainfrom
@tjzel/mocks/reexport-jestUtils

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
@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