-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Collector fails with very large test counts (>> 100000) #5234
Comments
See vitest/packages/runner/src/utils/tasks.ts Line 20 in e191e65
|
Interesting find. It looks like this limitation is coming from runtime and people have especially have seen this when using Just quick experiment on repl: $ node
Welcome to Node.js v20.11.0.
Type ".help" for more information.
> [].push(...Array(1000000))
Uncaught RangeError: Maximum call stack size exceeded
> Math.max(...Array(1000000))
Uncaught RangeError: Maximum call stack size exceeded
> (() => {})(...Array(1000000))
Uncaught RangeError: Maximum call stack size exceeded
> [...Array(1000000)]
[
undefined, undefined, undefined, undefined, undefined, undefined,
...
] I think it would nice if we can avoid it, but there might be a few more places doing |
I've validated the changes by patching the |
Describe the bug
When a suite contains a huge number of tests (>> 100000), the collector's usage of the spread operator results in a "Maximum call stack size exceeded error".
Reproduction
Include a huge number of tests (e.g., using
it.each
).See https://stackblitz.com/edit/vitest-dev-vitest-pf19qj?file=test%2Fsuite.test.ts.
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: