You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not seem to be correct, as this is not true for returned rejected promises in all environments; in my case Node.js 8.10. I'm using adapter.onGet(...).timeout() and I see:
This leads to the flow going to utils.settle instead of result.then, the promise not getting handled and erroring, and the original error getting lost, which is bad.
On further inspection, it is not a feature of Node, but somehow specific to the VM that Jest sets up - Promise objects look a little different there, but I can't really tell why. Could be occurring in VM's created by other test frameworks, but I haven't had a look at them.
Writing test cases seems difficult as I can't find a good way to simulate functions like this.
However, as the intent here seems to be "if result.then is callable, settle result like a Promise", so the solution should be simple somehow.
The
handleRequest
function checks forresult.then instanceof Function
to determine if a Promise result is returned from the handler, in https://github.com/ctimmerm/axios-mock-adapter/blob/master/src/handle_request.js#L52This does not seem to be correct, as this is not true for returned rejected promises in all environments; in my case Node.js 8.10. I'm using
adapter.onGet(...).timeout()
and I see:This leads to the flow going to
utils.settle
instead ofresult.then
, the promise not getting handled and erroring, and the original error getting lost, which is bad.Possibly related: #122
I believe adding the
typeof
check would do the intended functionality correctly here?The text was updated successfully, but these errors were encountered: