node icon indicating copy to clipboard operation
node copied to clipboard

assert: partialDeepStrictEqual does not properly work comparing Int16Arrays, ArrayBuffers and SharedArrayBuffers

Open puskin94 opened this issue 2 months ago • 0 comments

Version

v24.0.0-pre

Platform

Darwin prot-2.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031 arm64

Subsystem

No response

What steps will reproduce the bug?

Following what still needed to be done in https://github.com/nodejs/node/pull/54630 , I kept looking for discrepancies between what works with assert.deepStrictEqual and what should work with assert.partialDeepStrictEqual but it does not.

const assert = require('assert');

assert.throws(() => assert.partialDeepStrictEqual(new ArrayBuffer(3), new SharedArrayBuffer(3)), Error);
assert.throws(() => assert.partialDeepStrictEqual(new Int16Array(3), new Uint16Array(3)), Error);
assert.partialDeepStrictEqual(new Int16Array([1, 2, 3]), new Int16Array([1, 2, 3]));

all the tests above will fail, while they should not

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

const assert = require('assert');

assert.throws(() => assert.partialDeepStrictEqual(new ArrayBuffer(3), new SharedArrayBuffer(3)), Error);
assert.throws(() => assert.partialDeepStrictEqual(new Int16Array(3), new Uint16Array(3)), Error);
assert.partialDeepStrictEqual(new Int16Array([1, 2, 3]), new Int16Array([1, 2, 3]));

all the tests above will fail, while they should not

What do you see instead?

the tests above will fail

Additional information

No response

puskin94 avatar Dec 01 '24 14:12 puskin94