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

Stack overflow caused by large output #5614

Closed
6 tasks done
RobinClowers opened this issue Apr 24, 2024 · 2 comments
Closed
6 tasks done

Stack overflow caused by large output #5614

RobinClowers opened this issue Apr 24, 2024 · 2 comments

Comments

@RobinClowers
Copy link

Describe the bug

This appears to be a regression of #3060. When an error occurs with a very large output (in my case from @testing-library/react), picocolors causes a stack overflow.

⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
RangeError: Maximum call stack size exceeded
 ❯ replaceClose node_modules/picocolors/picocolors.js:22:21
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30
 ❯ replaceClose node_modules/picocolors/picocolors.js:25:30

Reproduction

Unfortunately I don't have a reproduction handy. I suspect this would reproduce with RTL, a large dom and DEBUG_PRINT_LIMIT=100000 vitest.

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 5.56 GB / 64.00 GB
    Shell: 5.2.15 - /opt/homebrew/bin/bash
  Binaries:
    Node: 18.18.0 - ~/.volta/tools/image/node/18.18.0/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 9.8.1 - ~/.volta/tools/image/node/18.18.0/bin/npm
  Browsers:
    Brave Browser: 121.1.62.156
    Chrome: 124.0.6367.62
    Chrome Canary: 121.0.6125.0
    Edge: 124.0.2478.51
    Firefox: 125.0.1
    Safari: 17.4.1
  npmPackages:
    vitest: ^1.5.0 => 1.5.0

Used Package Manager

yarn

Validations

@hi-ogawa
Copy link
Contributor

The linked issue #3060 seems related, but I'm not sure how to get the error considering the fix #3078 seems okay.

I tried something like this and still seems fine with DEBUG_PRINT_LIMIT=100000:

    const node = <div id="hey">
      {[...Array(5000)].map(i => <div key={i} id={i} style={{ color: "red" }}><span/></div>)}
    </div>
    render(node);
    screen.getByRole('no-such-thing') // testing-library throws an error
TestingLibraryElementError: Unable to find an accessible element with the role "no-such-thing"

There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      id="hey"
    >

Copy link

Hello @RobinClowers. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants