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
0.19.0 no longer works with xhr-mock #2195
Comments
Also started seeing the same problem with sinon.js |
@rybon and @jmelvin-r7 could you create a runkit example for your use case and post it here, that will help a lot with debugging. In addition, can you let me know if there are any |
@jasonsaayman - I'm not able to get the tests to run as expected on runkit, but here's the test file that I know works with api.test.js
package.json
Bump the |
@jasonsaayman - I've got a fix for it, really straightforward. The issue was introduced here: 0b3db5d Part of the change in that commit was the order of the if/else blocks. If those are reversed, the tests pass, and the browser environment still appears to work fine. Unfortunately, I'm unable to push a branch as I'm not considered a collaborator, I believe. |
Over here upgrading to Axios v0.19.0 doesn't necessarily cause failing tests however it does end up logging a lot of UnhandledPromiseRejection warnings as seen below. Downgrading back to v0.18.0 resolves this issue.
|
@jmelvin-r7 thanks for the pull request, I am going to look at reviewing it tonight. @favna I will have a look at trying to replicate this. |
@jasonsaayman thanks you. I cant share a lot of code as it's private company code but I can say it's TypeScript based and using React, Redux-Saga (and Redux then ofc). |
@favna, @jmelvin-r7 I pulled this, then had a look and I had the same issue as you guys described. I also agree with @masterots that pull request #2201 does in face mend this and does not break anything else. I cannot merge so we will have to wait for @emilyemorehouse to get to this, I will change the labels appropriately. |
Awesome, thanks! I'll let my team know. |
Also, @masterots is the same person as @jmelvin-r7 😁, separate work/personal accounts. |
@jasonsaayman Thanks! Looking forward to the future release to fix the issue. |
Version 0.19.0 has breaking change and does not work with the Sinon mock server Issue: axios/axios#2195
Version 0.19.0 has a breaking change and is not compatible anymore with the Sinon mock server. Issue: axios/axios#2195
So this is closed, but the PR is not not merged in the axios repo. Does this mean that we're just SOL? |
Tbh I switched out frontend projects over to GitHub's whatwg-fetch because of this issue. It's absolutely ridiculous how long it takes the devs to release anything here and in terms of trends axios is an absolute joke compared to whatwg- fetch: source: https://www.npmtrends.com/axios-vs-whatwg-fetch (recorded at August 20th 2019, 09:12 PM UTC+0) Also because whatwg-fetch uses browser fetch as its API you don't need additional typings when writing TypeScript, just need to specify the DOM lib, and it has a synonymous API in the backend with node-fetch |
Describe the bug
Running Jest unit tests with xhr-mock https://github.com/jameslnewell/xhr-mock fail. Reverting to 0.18.0 fixed it.
The text was updated successfully, but these errors were encountered: