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

feat: add automocking in vitest #666

Merged
merged 3 commits into from
Apr 30, 2024
Merged

feat: add automocking in vitest #666

merged 3 commits into from
Apr 30, 2024

Conversation

dcdms
Copy link
Contributor

@dcdms dcdms commented Apr 24, 2024

react-native-mmkv already has automocking for Jest, but not for Vitest.

This commit adds automocking for Vitest test environments just by checking if the VITEST_WORKER_ID environment variable is present.

This new functionality was also documented in the README, in the "Testing with Jest or Vitest" section, formerly the "Testing with Jest" section.

This way, MMKV will be mocked in both Jest and Vitest test environments.

@mrousavy
Copy link
Owner

Interesting, thanks for your PR!

Changes look good, but do people actually use Vitest in RN apps?

@dcdms
Copy link
Contributor Author

dcdms commented Apr 29, 2024

Changes look good, but do people actually use Vitest in RN apps?

This package was created to integrate React Native and Vitest, so I am using them together.

About the error during CI, this appears to be an error in the integration between Eslint and Prettier. I will fix this.

When running the lint command, Eslint was displaying an error and not
working.

This commit fix this by:

- Updating dependencies by running `yarn upgrade`
- Setting up `eslint-plugin-prettier`
@dcdms
Copy link
Contributor Author

dcdms commented Apr 29, 2024

Oops! I'll see what went wrong and fix it.

@mrousavy mrousavy merged commit 86d5e94 into mrousavy:master Apr 30, 2024
4 of 5 checks passed
@mrousavy
Copy link
Owner

Thank you!

@dcdms dcdms deleted the dcdm3g/automocking-in-vitest branch April 30, 2024 10:13
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