-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: Cypress hangs when wrapping an object containing circular references #32917
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cypress
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress
|
| Branch Review |
fix-wrap-circular-reference-log
|
| Run status |
|
| Run duration | 34m 31s |
| Commit |
|
| Committer | Jennifer Shehane |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
11
|
|
|
1098
|
|
|
4
|
|
|
26594
|
| View all changes introduced in this branch ↗︎ | |
Warning
Partial Report: The results for the Application Quality reports may be incomplete.
UI Coverage
45.48%
|
|
|---|---|
|
|
188
|
|
|
161
|
Accessibility
97.98%
|
|
|---|---|
|
|
4 critical
8 serious
2 moderate
2 minor
|
|
|
101
|
ryanthemanuel
approved these changes
Nov 11, 2025
Contributor
|
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additional details
When
cy.wrap()is called with objects containing circular references, the logging code instringifyActualcauses infinite recursion because it doesn't track visited objects. This can lead to stack overflow errors - which cause the Cypress App to completely hang.I'm not sure if this is an issue with other command logs, but this addresses the issue with logging in general, so it would resolve situations there as well.
Steps to test
yarn cypress:openHow has the user experience changed?
Before
!!!! Complete Cypress App hang when running the test
After
PR Tasks
cypress-documentation?type definitions?Note
Track visited objects to safely stringify circular structures, preventing
cy.wrap()hangs and updating tests and changelog accordingly.packages/driver/src/cypress/utils.tsto detect circular references using aWeakSetinstringifyActual()/stringifyActualObj()and return[Circular],Array[N], orObject{N}safely.cy.wrap()inpackages/driver/cypress/e2e/commands/misc.cy.js(objects, arrays, nested/multiple refs; ensure logs include[Circular]and chaining works).packages/driver/cypress/e2e/cypress/utils.cy.jsto assert safe stringification of circular objects/arrays and adjust expectations for small/large arrays and object key counts.cy.wrap()freezing on circular references incli/CHANGELOG.md.Written by Cursor Bugbot for commit f84e3f4. This will update automatically on new commits. Configure here.