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

pretty-format crashes with OOM #4645

Closed
SimenB opened this issue Oct 10, 2017 · 2 comments · Fixed by #4664
Closed

pretty-format crashes with OOM #4645

SimenB opened this issue Oct 10, 2017 · 2 comments · Fixed by #4664
Assignees
Labels

Comments

@SimenB
Copy link
Member

SimenB commented Oct 10, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
I have a HtmlDivElement from jsdom I'm trying to pass though pretty-format. But pretty-format dies with an OOM.

image

See https://github.com/SimenB/pretty-format-crash for a reproduction.

If I remove the div below the svgs pretty-format has a different crash

/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/collections.js:181
      result += indentationNext + name + ': ' + value;
                                              ^

RangeError: Invalid string length
    at printObjectProperties (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/collections.js:181:47)
    at printComplexValue (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:231:42)
    at printer (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:301:10)
    at printObjectProperties (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/collections.js:179:21)
    at printComplexValue (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:231:42)
    at printer (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:301:10)
    at printObjectProperties (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/collections.js:179:21)
    at printComplexValue (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:231:42)
    at prettyFormat (/Users/simbekkh/repos/ugh/node_modules/pretty-format/build/index.js:445:10)
    at Object.<anonymous> (/Users/simbekkh/repos/ugh/index.js:13:13)

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 and yarn test.

What is the expected behavior?
It should not crash, but output beautifully formatted markup

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
[email protected], [email protected], [email protected], macOS.

@SimenB
Copy link
Member Author

SimenB commented Oct 10, 2017

Note that this only happens with jsdom@11, not with jsdom@9 (which is what is used within jest)

@github-actions
Copy link

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.
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.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants