-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
In
| const pretty = stringify(dom, Number.POSITIVE_INFINITY, { |
stringify and in vitest/packages/utils/src/display.ts
Line 77 in 345d281
| ? stringify(object, Math.floor(maxDepth / 2)) |
Infinity / 2 = Infinity, the code enters in a loop and ends up crashing the page.
Reproduction
Found it in private big project (can only be reproduced if the DOM is large enough to enter the result.length >= MAX_LENGTH check. Maybe we can reproduce it by adding a unit test where we send a really small maxDepth and the whole page as object.
System Info
System:
OS: macOS 15.1.1
CPU: (14) arm64 Apple M3 Max
Memory: 6.47 GB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
Yarn: 4.6.0 - ~/.nvm/versions/node/v20.12.2/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
pnpm: 9.15.2 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
Browsers:
Chrome: 131.0.6778.265
Safari: 18.1.1Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)