Open milung opened 7 months ago
I have the same issue with the version 1.6.2. Is there any work around?
the function hasStandardBrowserEnv is missing the original conditions typeof window !== 'undefined' && typeof document !== 'undefined';
This code is still there but refactored as an external constant
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 platform.isStandardBrowser
isundefined
. The reason is that the constants were defined and exported from lib/platform/browser/index.js
but this module was not imported into helpers/isSameURLOrigin.js
. Its imports states:
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 lib/platform/common/utils.js
in 1.6.1 change, the constants get now evaluated in the test environment, therefore the breaking change.
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 https://github.com/axios/axios/pull/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.
Hi,
Any resolution for this? I was facing with axios-mock-adapter after upgrading my axios version.
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