-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Breaking change in 1.6.1 release does not allow to create axios instance in tests #6093
Comments
I have the same issue with the version 1.6.2. Is there any work around? |
This code is still there but refactored as an external constant |
@DigitalBrainJS - yes you right. After further investigation I found the possible suspect - in 1.6.0 the import utils from './../utils.js';
import platform from '../platform/index.js'; and `platform/index.js imports are import platform from './node/index.js';
export {platform as default} Not sure if that was originally by intention, but by moving the code into the |
I'm experiencing the same issue. Attempting to upgrade from v0.x mostly to fix an open vulnerability with axios in that major version as noted here #6091 however this issue making tests unable to use axios has become blocking. It's not possible to get a version of axios with the vulnerability fix AND tests still executing. |
Any news on this issue? It currently blocks us from updating, since all our tests which include Axios are failing... |
Describe the bug
When testing the application and trying to mock the axios (e.g. axios-mock-adapter, but generally any
axios.create()
call) I get error "TypeError: Invalid URL", which is caused by the fact that the change of the 1.6.1 of the functionhasStandardBrowserEnv
is missing the original conditionstypeof window !== 'undefined' && typeof document !== 'undefined';
in the functionisStandardBrowserEnv
. That leads to the attempt to create and read url path from the document location, which is eventually not initialized yet.To Reproduce
In my case I find it with stencil:
in file
.../src/components/my-component/my-component.spec.ts
addCode snippet
Expected behavior
Either to have possibility to enforce "nonstandardBrowser" or to preserve behaviour of version 1.6.0
Axios Version
1.6.1
Adapter Version
No response
Browser
puppeteer
Browser Version
20,2,0
Node.js Version
21.1.1
OS
Windows 11
Additional Library Versions
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: