feat: port test_typedarray SharedArrayBuffer test to CTS - #68
Open
hexbinoct wants to merge 1 commit into
Open
Conversation
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>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #61.
Ports
test/js-native-api/test_typedarray/test_sharedarraybuffer.jsandits addon from nodejs/node, covering
napi_create_typedarrayover aSharedArrayBuffer-backed view.
The addon is a second target in the
test_typedarraydirectory ratherthan two more functions on the existing one, because that addon's
CreateTypedArrayassertsnapi_is_arraybufferon 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.typedarraySharedArrayBufferthatmirrors the existing
dataviewSharedArrayBuffergate.Verified on both toolchains I can reach:
Visual Studio 17 2022CMake generator. Node v24.18.1 and v26.5.1 runthe file, 47/47 pass. Node v24.14.0 takes the skip path, 47/47.
the
Unix Makefilesgenerator. 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 lintis clean on both. macOS I cannot test here, though nothingin 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 itreports 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.xreaches the newly gated code today, and only sincev24.18.0 (2026-06-23).
25.xhas had no release since 2026-03-31.Claude Opus 5 wrote the port and drafted this text; I reviewed both.