-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Comments
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 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"
> |
Hello @RobinClowers. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
Can I get this issue reopened? I've created a reproduction. Just Let me know if I should open a new issue instead of reopening this one. |
Confirmed the issue. Thanks for the reproduction 👍 |
It seems like call stack error is due to a specific implementation of picocolors and technically it can be avoided, so I raised an issue upstream alexeyraspopov/picocolors#63. As upstream might not progress fast, Vitest can still fix this by patching picocolors or simply truncate the error message wherever this is happening. Also the minimum repro is this: // CI=1 npm run test
import { test } from "vitest";
test("repro", () => {
const x = "\x1b[34m" + "x" + "\x1b[39m"
throw new Error(x.repeat(10000));
}) |
The upstream issue is fixed and thanks @hi-ogawa for contribution. |
@hi-ogawa are you planning to bump the version in vitest? I'm happy to submit that PR if that's helpful. |
@RobinClowers I also confirmed the last reproduction is fixed with package.json Also |
Yeah, I already updated my app, just wanted to make sure it would land here, sounds like the renovate PR has it covered! |
Cool, thanks for the reminder! As you confirmed it's working for you, I'll close this issue then. I just remembered that Vitest has utilities which is mostly a copy of picocolors internally, so I'm updating that in a separate PR #5733. |
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.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
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: