We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Cannot stub got (the http request library)
` import sinon, { stubObject } from "ts-sinon"; import got, { Got } from 'got';
const gotMock = stubObject(got); //crashes `
Error message: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
The text was updated successfully, but these errors were encountered:
I get this also trying to mock AxiosInstant like so
const axiosInstance = axios.create(); const mockAxios = stubObject<AxiosInstance>(axiosInstance);
Sorry, something went wrong.
I get this also trying to mock AxiosInstant like so const axiosInstance = axios.create(); const mockAxios = stubObject<AxiosInstance>(axiosInstance);
@sblausten you can mock AxiosInstance this way:
AxiosInstance
//import import { stubInterface } from "ts-sinon"; //... const expectedResponse = { "status": 200 }; const stub = stubInterface<AxiosInstance>(); stub.post.withArgs( `/v1/my-apy`, { data: { foo: 'bar' } }, ) .resolves(Promise.resolve(expectedResponse)); //assertion expect(stub.post.called).to.be.true;
No branches or pull requests
Cannot stub got (the http request library)
`
import sinon, { stubObject } from "ts-sinon";
import got, { Got } from 'got';
const gotMock = stubObject(got); //crashes
`
Error message: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
The text was updated successfully, but these errors were encountered: