FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: port test_typedarray SharedArrayBuffer test to CTS by hexbinoct · Pull Request #68 · nodejs/node-api-cts · GitHub

feat: port test_typedarray SharedArrayBuffer test to CTS - #68

Open
hexbinoct wants to merge 1 commit into
nodejs:mainfrom
hexbinoct:hexbinoct/port-typedarray-sharedarraybuffer
Open

feat: port test_typedarray SharedArrayBuffer test to CTS#68
hexbinoct wants to merge 1 commit into
nodejs:mainfrom
hexbinoct:hexbinoct/port-typedarray-sharedarraybuffer

Conversation

Copy link
Copy Markdown
Contributor

Closes #61.

Ports test/js-native-api/test_typedarray/test_sharedarraybuffer.js and
its addon from nodejs/node, covering napi_create_typedarray over a
SharedArrayBuffer-backed view.

The addon is a second target in the test_typedarray directory rather
than two more functions on the existing one, because that addon's
CreateTypedArray asserts napi_is_arraybuffer on its second argument,
which is false for a SharedArrayBuffer. Upstream split it for the same
reason.

The capability landed in Node.js v26.2.0 and v24.18.0
(nodejs/node#62710). It was not backported to
v20.x or v22.x, and the v25.x line saw no release after it, so the file
is gated on a new runtimeFeatures.typedarraySharedArrayBuffer that
mirrors the existing dataviewSharedArrayBuffer gate.

Verified on both toolchains I can reach:

  • Windows, Visual Studio 2022 with MSVC 19.44.35228.0, through the
    Visual Studio 17 2022 CMake generator. Node v24.18.1 and v26.5.1 run
    the file, 47/47 pass. Node v24.14.0 takes the skip path, 47/47.
  • Linux in Docker (Debian bookworm), GCC 12.2.0 and CMake 3.25.1 through
    the Unix Makefiles generator. Node v26.5.1 and v24.18.1 run the file,
    47/47 pass. Node v22.23.2 takes the skip path, 47/47.

npm run lint is clean on both. macOS I cannot test here, though nothing
in the change is platform specific beyond the second CMake target.

The file also fails when it should: with the gate forced true on
v24.14.0, it stops at the first SharedArrayBuffer case with
Error: Invalid argument, after the ArrayBuffer block has passed. So it
reports a runtime that lacks the feature rather than passing vacuously.

One thing worth flagging separately: of the four versions in the test
matrix, only 24.x reaches the newly gated code today, and only since
v24.18.0 (2026-06-23). 25.x has had no release since 2026-03-31.

Claude Opus 5 wrote the port and drafted this text; I reviewed both.

Ports test/js-native-api/test_typedarray/test_sharedarraybuffer.js and its
addon from nodejs/node, covering napi_create_typedarray over a
SharedArrayBuffer-backed view.

The existing test_typedarray addon cannot host it: its CreateTypedArray
asserts napi_is_arraybuffer on the second argument, which is false for a
SharedArrayBuffer. Upstream added a separate addon for the same reason.

Gated on runtimeFeatures.typedarraySharedArrayBuffer, since the capability
only landed in Node.js v26.2.0 and v24.18.0 (nodejs/node#62710).

Fixes: nodejs#61

Signed-off-by: hexbinoct <abubakarm@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
hexbinoct force-pushed the hexbinoct/port-typedarray-sharedarraybuffer branch from 62f51b6 to 254e4d4 Compare August 21, 2026 04:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Need Triage

Development

Successfully merging this pull request may close these issues.

Port SharedArrayBuffer TypedArray test

1 participant


Back | FazBrowse Home | New Git URL