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
Since 0.21.2, nock-based tests of client that uses axios fail #4036
Comments
@filmaj will have a look soonest :) |
It seems to come from #2702 cc @SashaKoro @nerdbeere |
There is a dependabot PR in forum-service to bump axios to `0.21.2`. This PR is failing unit tests for some reason. I am hoping that upgrading past `0.21.2` to the latest `0.21.4` resolves these issues. Unfortunately the type signatures for the latest version of axios and the version of axios included in `@lifeomic/alpha` don't match. This PR bumps axios to the latest version. See: https://github.com/lifeomic/forum-service/pull/171 https://github.com/lifeomic/life-extend/pull/1690 axios/axios#4036
@jasonsaayman @filmaj |
Can confirm this problem, in my testing it occurred in all versions |
So, as you all maybe know. There is a high-security issue in all versions below and including 0.21.1. In some packages.json can't be upgraded to 0.21.2 because the tests are failing. From a security perspective, (nobody wants CISO breathing on the developer's neck). Maybe this should have a higher priority. :) |
I'm starting to dig into this issue a bit more, I haven't made much progress yet but for the record this issue still exists in 0.24.0. |
Just verified the issue is caused by #2609, revert the PR then problem disappear:
|
Caught the bug! https://github.com/axios/axios/pull/2702/files#r775144238 |
Sorry for the bother, the bug already fixed in #4013, upgrade to newer version(0.21.4) resolved my problem. 😅😅 |
Closing as this is solved as mentioned above |
Hi 👋
Before diving into the issue, just want to say: thanks for creating, maintaining and supporting this great library! Much appreciated ❤️
Describe the bug
Since axios v0.21.2, tests for Slack's
web-api
npm package have started failing (see e.g. this test run).This package uses
nock
for testing, which is a library that intercepts HTTP requests and allows for easy mocking of responses to quickly test things like API client libraries that use axios under the hood.nock
-based tests for certain specific API methods of our library started failing in the past few days.After some digging, we were able to determine that something changed between axios v0.21.1 and v0.21.2. v0.21.1 works as expected, however v0.21.2 and newer (including .3 and .4) yields failures. It looks like newer axios versions' requests don't get intercepted by nock anymore 🤔
To Reproduce
I have created a reproduction case as a gist: https://gist.github.com/filmaj/f5097da82ecc9d429b983ee5561b8839
Clone the above,
cd
into the directory, runnpm install
and thennpm test
. Tests should pass. Great! Now for the not-so-great part: editpackage.json
and bump up theaxios
dependency from0.21.1
to e.g.0.21.2
or newer. Runnpm install
again and thennpm test
. Womp womp, failures.Expected behavior
Using the above repro case / gist, this is what output looks like (the debug output is from both the Slack web-api debug logs as well as a subset of nock's debug output) when using axios v0.21.1:
Actual behavior
Using the above repro case / gist, this is what output looks like (the debug output is from both the Slack web-api debug logs as well as a subset of nock's debug output) when using axios v0.21.2:
Environment
Additional context/Screenshots
Leaving this section here as empty because apparently the issue will close if I remove this section?
The text was updated successfully, but these errors were encountered: