File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
tests/js-native-api/test_typedarray Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ assert.strictEqual(externalResult[0], 0);
3636assert . strictEqual ( externalResult [ 1 ] , 1 ) ;
3737assert . strictEqual ( externalResult [ 2 ] , 2 ) ;
3838
39+ // Float16Array is an ES2025 addition; not exposed by default in older V8
40+ // versions (e.g. those shipped with Node 20.x / 22.x). Detect at runtime and
41+ // only exercise the Float16Array code paths when the engine supports it.
42+ const hasFloat16Array = typeof Float16Array !== "undefined" ;
43+
3944// Validate creation of all kinds of TypedArrays
4045const buffer = new ArrayBuffer ( 128 ) ;
4146const arrayTypes = [
@@ -46,7 +51,7 @@ const arrayTypes = [
4651 Uint16Array ,
4752 Int32Array ,
4853 Uint32Array ,
49- Float16Array ,
54+ ... ( hasFloat16Array ? [ Float16Array ] : [ ] ) ,
5055 Float32Array ,
5156 Float64Array ,
5257 BigInt64Array ,
@@ -79,7 +84,7 @@ const nonByteArrayTypes = [
7984 Uint16Array ,
8085 Int32Array ,
8186 Uint32Array ,
82- Float16Array ,
87+ ... ( hasFloat16Array ? [ Float16Array ] : [ ] ) ,
8388 Float32Array ,
8489 Float64Array ,
8590 BigInt64Array ,
You can’t perform that action at this time.
0 commit comments