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

chore(test): Use Mocha.js instead of Jest #142

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Conversation

JoseLion
Copy link
Member

@JoseLion JoseLion commented Mar 19, 2024

This PR refactors the test to use Mocha.js instead of Jest. This is possible thanks to react-native-testing-mocks. There are more than a few reasons to prefer Mocha.js over Jest, but the main benefits are:

  • Test run 12x faster. No need to transpile all files before running the tests
  • We don't need the Babel dependencies and configuration in the package anymore
  • Decouples mocks and spies from the test framework

@JoseLion JoseLion requested a review from alejo0o March 19, 2024 15:11
@JoseLion JoseLion self-assigned this Mar 19, 2024
@JoseLion JoseLion force-pushed the chore/test-with-mochajs branch 3 times, most recently from a19dfdf to 55ea954 Compare March 27, 2024 17:34
@JoseLion JoseLion force-pushed the chore/test-with-mochajs branch from 55ea954 to 10a5d8e Compare March 27, 2024 17:46
Copy link
Contributor

@alejo0o alejo0o left a comment

Choose a reason for hiding this comment

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

This is great TBH! Let me know when u have time to understand better this library

Comment on lines -49 to -53
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@react-native/babel-preset": "^0.73.21",
"@testing-library/react-native": "^12.4.3",
"@types/jest": "^29.5.12",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is dope 👍

Comment on lines +41 to +47
mockNative("View", {
measureInWindow: callback => {
const { height, width, x, y } = viewMockMeasureData;
callback(x, y, width, height);
},
});

Copy link
Contributor

Choose a reason for hiding this comment

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

🤯

@JoseLion JoseLion merged commit 4986057 into main Apr 4, 2024
4 checks passed
@JoseLion JoseLion deleted the chore/test-with-mochajs branch April 4, 2024 16:00
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.

2 participants