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
[Bug]: Error converting circular structure to JSON #14840
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
We see the same issue. Would be awesome if we could get a bug fix for this. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
still relevant. not sure if/when I will have time to productionize this, so would encourage others who are affected to take a stab if you can! |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
still relevant |
Version
v29.7.0, v30.0.0-alpha.2
Steps to reproduce
npx jest --workerIdleMemoryLimit=1GB path/to/the.test.js
(note:--workerIdleMemoryLimit
is just to force Jest to use workers, which you could also trigger by running many tests,--watch
, etc.)Test:
Expected behavior
I expect to see an error in my code! Which of course happens if you remove
e.e = e
.Note that this works fine without workers, and in some cases it works fine even with them (I haven't figured out why.) It seems that in some code paths Jest effectively destructures the error, getting only the fields it will use (i.e. not
e
) and then passing those over to the parent process, but in others it serializes the whole error, which fails.Actual behavior
The error is as follows:
This gives very little information about what actually went wrong. (
Additional context
Of course in a simple repro the answer is simply "don't do that". But in the real cases I started from, I believe the error was likely thrown from third-party code, in an integration test in a large codebase so it's very hard to know. The circular structure in question was a
ClientRequest
, which could be used in many places. So having no stacktrace from Jest makes it very hard to track down.For now I've hacked around it with the following patch:
Probably the more robust approach is something more like what
reportError
does, but this was easier to hack in.See also specific cases that may be the same/similar issues: #11958, #10577
Environment
The text was updated successfully, but these errors were encountered: