Skip to content

test(mapValues): cover prototype-key handling across callback and Promise APIs - #2141

Open
lanqing431 wants to merge 1 commit into
caolan:masterfrom
lanqing431:test/map-values-prototype-boundaries
Open

lanqing431 wants to merge 1 commit into
caolan:masterfrom
lanqing431:test/map-values-prototype-boundaries

Conversation

@lanqing431

Copy link
Copy Markdown

The existing prototype-key test is inside the mapValuesLimit context but actually calls mapValues. It also covers only the callback form.

Replace it with a shared table that exercises mapValues, mapValuesLimit with a finite limit, and mapValuesSeries, using callbacks and Promises. Check that ordinary prototype-named keys are visited and preserved, the own __proto__ input key is skipped, and the returned object retains its ordinary prototype without inherited data from the input.

No runtime implementation changes are included. This is a source-audit test coverage improvement, not a claimed production incident.

Validation on Windows / Node 24.22.0:

  • npm test: 708 passing, 0 failing; includes the repository lint command.
  • Targeted table: 6 passing.
  • Negative control: temporarily disabling the iterator's __proto__ skip makes all 6 table cases fail. The source was restored byte-for-byte before the final full test run.
  • git diff --check: pass.

Browser/other-Node-version matrices were not run locally. No generated distribution or release files are changed.

AI assistance was used for the tests and technical review.

Exercise mapValuesLimit itself and both callback and Promise forms
of the three mapping variants.

Co-authored-by: codex <codex@openai.com>

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.

1 participant