yea I looked into it and I think you are right for the first part.
However I don't think it's incompatibility issue between jest / sinon.
Since jest runs the code in the node environment, not all browser native functions are properly implemented. If you are using fetch - some polyfill libraries work correctly with sinon (e.g. whatwg-fetch), while others don't (e.g. isomorphic-fetch). sinon's fakeServer also does not work with axios correctly if you are using that.
The error you are getting indicates the fake server is not mocking the correct fetch (or XMLHttpRequest) - real requests are being made in the test environment - maybe it's better to investigate how you can mock the request library/method you are using directly with jest.
yea I looked into it and I think you are right for the first part.
However I don't think it's incompatibility issue between jest / sinon.
Since
jest
runs the code in the node environment, not all browser native functions are properly implemented. If you are usingfetch
- some polyfill libraries work correctly with sinon (e.g.whatwg-fetch
), while others don't (e.g.isomorphic-fetch
). sinon's fakeServer also does not work withaxios
correctly if you are using that.The error you are getting indicates the fake server is not mocking the correct
fetch
(orXMLHttpRequest
) - real requests are being made in the test environment - maybe it's better to investigate how you can mock the request library/method you are using directly withjest
.Yeah, I gave up and mocked my endpoint functions, which are a simple layer atop superagent, which uses XHR.