-
Notifications
You must be signed in to change notification settings - Fork 10
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
fetchMock is not defined after upgrading to 0.4.0 #28
Comments
I think it's because |
A workaround could be to export your instance of export const fetchMock = createFetchMock(vi);
fetchMock.enableMocks(); import { fetchMock } from 'path/to/your/fetch-mock`;
// ...
fetchMock.ANYMETHOD() Personally I would recommend this approach anyway, since it's a bad practice to mess around with globals. Otherwise, you could wait for #29 to be merged and released, since it's actually a regression that breaks backwards compatibility. |
I think I can wait! Thanks for the blazing fast help! |
Could you create a release for this fix? 🙂 |
0.4.1 is now released. |
Hello!
Unfortunately the documentation does not include any migration and I assume fetchMock should be available as before without any changes, but in my NextJS/Typescript Project, I get
ReferenceError: fetchMock is not defined
for all tests usingfetchMock.ANYMETHOD()
.Anything I'm missing?
The text was updated successfully, but these errors were encountered: