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 support to mock import of crossFetch #14

Closed

Conversation

leoferreiralima
Copy link

Added fix to reported issue #13

fix #13

@IanVS
Copy link
Owner

IanVS commented Sep 13, 2023

I'm not sure if this is a good idea, it feels a little unexpected to automatically mock such direct imports from cross-fetch. And I worry that it would break or conflict with the examples of conditional mocking at the end of the README.

In your issue, you showed two different ways to work around the problem of direct imports not being mocked. I wonder if the better solution here is to update the README to clarify the current behavior and present the two approaches you mentioned so that users can set up the mocks themselves if they desire.

What do you think? I'll leave this open for a while and give others a chance to chime in as well, since honestly I don't use this library extensively and maybe I'm missing some context.

All that said, thanks for the issue and the contribution!

@leoferreiralima
Copy link
Author

I think is a good option update the read with this context, other alternative is use other method to activate this mock, becaus i think this should be support by the library some way, maybe a method named enableDirectImport() to run this and the users can option to call or not this method as they wish

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.

Error when code import directly the cross-fetch library
2 participants