Skip to content

lib: use validateArray for array arguments - #65344

Open
DevJunz wants to merge 1 commit into
nodejs:mainfrom
DevJunz:lib/validate-array-followup
Open

lib: use validateArray for array arguments#65344
DevJunz wants to merge 1 commit into
nodejs:mainfrom
DevJunz:lib/validate-array-followup

Conversation

@DevJunz

@DevJunz DevJunz commented Aug 17, 2026

Copy link
Copy Markdown

Follow-up to #64959: replace the three remaining ArrayIsArray checks in
histogram.js and blocklist.js with validateArray(). The thrown error
is identical — validateArray throws the same
ERR_INVALID_ARG_TYPE(name, 'Array', value), and its minLength branch
cannot trigger at the default of 0.

The existing tests only asserted the error code, so this also adds
assertions on the exact error messages at all three call sites. They pass
both before and after the change.

Other similar sites in lib/ throw different expected-type strings and
are intentionally left alone.

Refs: #64959

Three call sites still duplicated the ArrayIsArray check that
validateArray already performs. Both files were already importing other
validators next to these checks. The error code, argument name and
expected type are unchanged, so the thrown error stays identical.

The ArrayIsArray primordial is no longer used in histogram.js and is
dropped from its destructuring; blocklist.js still uses it elsewhere.

The existing tests only asserted the error code, so assertions covering
the full error message are added for all three call sites. They pass
both before and after this change.

Refs: nodejs#64959
Assisted-by: claude:fable-5
Signed-off-by: JunHwan Choi <devjunsday@gmail.com>
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Aug 17, 2026
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (26398a9) to head (6bebdc2).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65344   +/-   ##
=======================================
  Coverage   90.13%   90.13%           
=======================================
  Files         752      752           
  Lines      251569   251604   +35     
  Branches    47264    47272    +8     
=======================================
+ Hits       226745   226790   +45     
+ Misses      16181    16164   -17     
- Partials     8643     8650    +7     
Files with missing lines Coverage Δ
lib/internal/blocklist.js 94.70% <100.00%> (-0.05%) ⬇️
lib/internal/histogram.js 94.76% <100.00%> (-0.01%) ⬇️

... and 35 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.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@atlowChemi atlowChemi added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants