Skip to content

Imitate symbol-keyed methods on objects and their prototypes - #553

Open
yushuosun wants to merge 1 commit into
testdouble:mainfrom
yushuosun:fix/imitate-symbol-properties-296
Open

yushuosun wants to merge 1 commit into
testdouble:mainfrom
yushuosun:fix/imitate-symbol-properties-296

Conversation

@yushuosun

Copy link
Copy Markdown

Fixes #296.

A method keyed by a symbol can still point to the original function after td.imitate(). Stubbing or calling that method on the imitation can then execute the real implementation.

Collect both string and symbol keys while walking the prototype chain, and use the original keys when defining the imitated properties. The regression uses two different symbols with the same description, one on the instance and one on its prototype. It checks that both become distinct test doubles and that the prototype method stays non-enumerable.

Tested on Windows with Node 24.14.1. The regression failed on main and passes with the change. The project build, unit and safe suites, and changed-file Standard checks passed.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 12:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Imitate should include Object.getOwnPropertySymbols

2 participants