You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing a related error with the latest version of axios ...
axios v1.6.8
axios-retry v4.1.0
agentkeepalive v4.5.0
Jest v29.7.0
Node.js v18.19.1
node:internal/child_process/serialization:159
node:internal/child_process/serialization:159
node:internal/child_process/serialization:159conststring=JSONStringify(message)+'\n';^
TypeError: ConvertingcircularstructuretoJSON-->startingatobjectwithconstructor'Object'|property'socket'->objectwithconstructor'Object'---property'_httpMessage'closesthecircleatstringify(<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:159:20)
at process.target._send (node:internal/child_process:845:17)
at process.target.send (node:internal/child_process:745:19)
at reportSuccess (<project>\node_modules\jest-worker\build\workers\processChild.js:82:11)
I see that axios added a AxiosError.toJSON() method some time ago to fix this issue so it may be a Jest problem.
Describe the bug
I get the error when run Jest for test.
It is because the
toJSON
function is a property at the prototype ofAxiosError
https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js#L33and the
jest
will remove the prototype at https://github.com/facebook/jest/blob/main/packages/jest-util/src/deepCyclicCopy.ts#L31.so the
AxiosError
cannot bestringify
because the__currentRequest.req
is a circular structurebut
Axios@0.26.x
is work fine, because thetoJSON
is the property ofAxiosError
https://github.com/axios/axios/blob/v0.26.1/lib/core/enhanceError.js#L13
To Reproduce
--watch
flagCode snippet
No response
Expected behavior
No response
Axios Version
latest
Adapter Version
http
Browser
No response
Browser Version
No response
Node.js Version
16.x
OS
No response
Additional Library Versions
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: