-
Notifications
You must be signed in to change notification settings - Fork 119
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
TypeScript integration not working #110
Comments
@yordis I'm running into the same issue, how did you solve this? |
import { GlobalWithFetchMock } from 'jest-fetch-mock';
const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
customGlobal.fetch = require('jest-fetch-mock');
customGlobal.fetchMock = customGlobal.fetch; Usage: afterEach(() => {
fetchMock.resetMocks();
});
expect(fetchMock.mock.calls[0][0].method).toEqual('GET'); I think this stop failing for me, I don't remember. |
@yordis These links aren't available =( |
@viT-1 let me fix it, I am so sorry |
just found another setup configuration (#82 (comment)): in jest setup file: in test:
|
Your "in test" part isn't actually necessary though it will fix the issue. As stated in the README, if you have an issue with "fetchMock" not being found, add a "global.d.ts" file at the root of the repository (or next to your tsconfig.json file) with the text |
I am not sure what I am doing wrong since I following the documentation
tests
it keeps saying
Cannot find name 'fetchMock' TS2304
The text was updated successfully, but these errors were encountered: