Skip to content

lib: avoid mutable push on private arrays - #67887

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:lib-private-arrays-no-push
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:lib-private-arrays-no-push

Conversation

@rozzilla

@rozzilla rozzilla commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

These call sites used .push() on private arrays. This uses indexed assignments instead.

junit.js and repl/transform.js already use ArrayPrototypePush on the same arrays a few lines away.

Same approach as #67748, #67751 and #67752: private arrays only, no performance claim. These are grouped in one PR because each subsystem only has one to three lines.

The junit reporter, the test runner's watch-mode stdio list and
coverage line ranges, the REPL import transform, the startup snapshot
callback lists, and Blob's arrayBuffer() used .push() on private
arrays, which looks up Array.prototype.push at call time. Replacing
that method from user code changed how these paths ran. Use indexed
assignments instead.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. test_runner Issues and PRs related to the test runner subsystem. v8 module Issues and PRs related to the node:v8 module. labels Nov 30, 2026
@atlowChemi atlowChemi added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 30, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 30, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.57%. Comparing base (1611823) to head (da8b885).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/repl/transform.js 0.00% 2 Missing ⚠️
lib/internal/test_runner/utils.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67887      +/-   ##
==========================================
- Coverage   90.58%   90.57%   -0.02%     
==========================================
  Files         802      802              
  Lines      286656   286656              
  Branches    55369    55369              
==========================================
- Hits       259668   259629      -39     
- Misses      17089    17125      +36     
- Partials     9899     9902       +3     
Files with missing lines Coverage Δ
lib/internal/blob.js 99.20% <100.00%> (ø)
lib/internal/test_runner/reporter/junit.js 99.10% <100.00%> (ø)
lib/internal/test_runner/runner.js 95.18% <100.00%> (ø)
lib/internal/v8/startup_snapshot.js 95.27% <100.00%> (ø)
lib/internal/test_runner/utils.js 66.88% <0.00%> (ø)
lib/internal/repl/transform.js 54.06% <0.00%> (ø)

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. test_runner Issues and PRs related to the test runner subsystem. v8 module Issues and PRs related to the node:v8 module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants