Skip to content

fix: should handle circular reference in error object correctly#728

Merged
9aoy merged 1 commit intomainfrom
fix/circular-reference-error
Dec 3, 2025
Merged

fix: should handle circular reference in error object correctly#728
9aoy merged 1 commit intomainfrom
fix/circular-reference-error

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Dec 3, 2025

Summary

should handle circular reference in error object correctly.
before:
image

after:
image

Related Links

fix #726

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 3, 2025 03:30
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 3, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 4036d82
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/692faed78302fb000873a7f1
😎 Deploy Preview https://deploy-preview-728--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug where error objects with circular references would cause serialization failures during test execution. The fix removes the problematic spread operator and JSON.stringify operations that couldn't handle circular references.

Key Changes

  • Removed spread operator (...error) that was copying all enumerable properties including circular references
  • Removed JSON.stringify logic for actual and expected properties that would throw on circular references
  • Explicitly set only the required fullStack property instead of spreading the entire error object

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/core/src/runtime/util.ts Fixed error formatting to explicitly extract properties instead of spreading, preventing circular reference issues
e2e/test-api/fixtures/circularReference.test.ts Added test fixture with circular reference between class instances to verify the fix
e2e/test-api/edgeCase.test.ts Added E2E test case to ensure circular references in error objects are handled correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy 9aoy merged commit 4575e04 into main Dec 3, 2025
32 of 33 checks passed
@9aoy 9aoy deleted the fix/circular-reference-error branch December 3, 2025 03:44
@9aoy 9aoy mentioned this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TypeError: Converting circular structure to JSON

2 participants