Skip to content
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

Do not call toJSON recursively in pretty-format #5044

Merged
merged 2 commits into from
Dec 9, 2017

Conversation

pedrottimark
Copy link
Contributor

Fixes #4956

If the returned value also has toJSON method:

Can y’all think of another way to fix this?

I don’t think plugins need another arg. However, they can call printer with optional arg if needed.

Test plan

Updated title and expected result of existing test

@codecov-io
Copy link

Codecov Report

Merging #5044 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5044   +/-   ##
=======================================
  Coverage   60.74%   60.74%           
=======================================
  Files         198      198           
  Lines        6605     6605           
  Branches        4        4           
=======================================
  Hits         4012     4012           
  Misses       2593     2593
Impacted Files Coverage Δ
packages/pretty-format/src/index.js 96.45% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6383322...eb4b06e. Read the comment docs.

@pedrottimark
Copy link
Contributor Author

AppVeyor build failed: no escape codes for colors in snapshots? I thought that had been fixed.

@cpojer cpojer merged commit 0c4399b into jestjs:master Dec 9, 2017
@cpojer
Copy link
Member

cpojer commented Dec 9, 2017

What if one object's toJSON returns another object's toJSON that would not lead to recursion? I think this fix here is fine, but we may want to consider adding a circular reference counter instead.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pretty-format toJSON maximum call stack error
4 participants