Skip to content

test,doc: cover and document multi-byte offset/size in randomFill - #64834

Open
kyungrae2002 wants to merge 3 commits into
nodejs:mainfrom
kyungrae2002:my-branch
Open

test,doc: cover and document multi-byte offset/size in randomFill#64834
kyungrae2002 wants to merge 3 commits into
nodejs:mainfrom
kyungrae2002:my-branch

Conversation

@kyungrae2002

@kyungrae2002 kyungrae2002 commented Jul 30, 2026

Copy link
Copy Markdown

test-crypto-random.js verified offset/size placement only for
single-byte buffers (Buffer / Uint8Array), so the element-to-byte
conversion for multi-byte typed arrays was never exercised. The docs for
randomFill() / randomFillSync() documented the size default only as
buffer.length - offset, which is meaningless for ArrayBuffer / DataView
(no .length), and never stated the offset/size unit.

  • Document that offset/size are in elements for a TypedArray and in
    bytes for an ArrayBuffer / DataView, with the default given per type
  • Add regression tests filling one element of a Uint16Array / Uint32Array
    at a non-zero offset, asserting neighboring elements are untouched

No runtime behavior changes.

Signed-off-by: kyungrae <kyungrae2002@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jul 30, 2026
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.16%. Comparing base (ed63b19) to head (8fc10c8).
⚠️ Report is 165 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64834      +/-   ##
==========================================
- Coverage   92.01%   90.16%   -1.86%     
==========================================
  Files         381      746     +365     
  Lines      170167   242764   +72597     
  Branches    26075    45739   +19664     
==========================================
+ Hits       156585   218877   +62292     
- Misses      13291    15387    +2096     
- Partials      291     8500    +8209     

see 532 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.

Signed-off-by: kyungrae <kyungrae2002@gmail.com>
Signed-off-by: kyungrae <kyungrae2002@gmail.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants