-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Pretty-format toJSON maximum call stack error #4956
Comments
From what I can understand in the docs, /cc @pedrottimark |
JSON is a string representation of JavaScript objects. |
@cpojer toJSON() is kind of middlware for JSON.stringify() transformation, and it |
Yap, you are right, my mistake. cc @pedrottimark |
I think @AntonPuko outlined some simple reproduction steps in qix-/color#134 (mentioned above). |
@NickMalt @AntonPuko Hello, friends. There is a unit test in which The problem is that Because By definition, Question for you and my fellow collaborators: can you think of a use case for A tentative local change breaks the one unit test and formats the pretty Jest color as follows: const Color = require('color');
const format = require('pretty-format');
format(Color.rgb(153, 66, 91));
/*
Object {
"color": Array [
153,
66,
91,
],
"model": "rgb",
"valpha": 1,
}
*/ |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
As I understand this code expect that
toJson
function return already stringified version of object, which is not right. And eventually this leads toMaximum call stack
error since printing of serializable object is not handled aftertoJSON
call. Or maybe I miss something?If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can
yarn install
andyarn test
.Debugging gif
What is the expected behavior?
handle serializable object printing after a
toJSON
callPlease provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
jest: 21.2.1
node: 9
The text was updated successfully, but these errors were encountered: