IanVS / vitest-fetch-mock

Vitest mock for fetch, forked from jest-fetch-mock
MIT License
59 stars 7 forks source link

Error when code import directly the cross-fetch library #13

Closed leoferreiralima closed 4 months ago

leoferreiralima commented 1 year ago

I'm make a setup to a repo on my github with vitest-fetch-mock, a file under the projet import the fetch from the cross-fetch module, but when i mock on test, this appers dont work, after sometime i found the error, is because the vitest-fetch-mock dont override the lib import.

Example: This not work image

This works image

Other alternative that works image

I presume this is a bug, i will make a PR to add the cross-fetch import mock, so this will not happen with anyone agaian