Open GerkinDev opened 1 year ago
@GerkinDev can you still prepare the PR, this looks like its really needs to be added
I'll do that tomorrow, and publish a built git branch you'll be able to install directly
Done. @mnikolaus you should be able to install it using npm install git+https://github.com/craft-ai/fork-axios-mock-adapter.git#built
Hi,
For testing purpose, I wanted to check the behavior of my application when receiving errors
ECONNRESET
,ENOTFOUND
,ECONNREFUSED
orEHOSTUNREACH
, and the only solution I found (after quite some time of research) was to do the following:While it seems to be working as expected, it's rather verbose, and would be super useful to have helpers to throw such errors. I've made a runkit with a few samples of those errors: https://runkit.com/embed/12bax0k5843m
Proposal:
Add an optional parameter to
networkError
, which would be thecode
of the error to throw. For what I've seen, errors could look like this:I'm OK to PR