aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bun.js/bindings/bindings.cpp2
-rw-r--r--test/js/bun/test/expect.test.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index bff5640ef..1e0d1c97e 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -618,7 +618,7 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2,
case Float64ArrayType:
case BigInt64ArrayType:
case BigUint64ArrayType: {
- if (!isTypedArrayType(static_cast<JSC::JSType>(c2Type))) {
+ if (!isTypedArrayType(static_cast<JSC::JSType>(c2Type)) || c1Type != c2Type) {
return false;
}
diff --git a/test/js/bun/test/expect.test.js b/test/js/bun/test/expect.test.js
index b6e312022..8c9959d01 100644
--- a/test/js/bun/test/expect.test.js
+++ b/test/js/bun/test/expect.test.js
@@ -640,6 +640,12 @@ describe("expect()", () => {
expect(g).not.toEqual(a);
});
+ test("deepEquals and typed arrays", () => {
+ expect(new Uint8Array([0, 255])).not.toEqual(new Uint8ClampedArray([0, 255]));
+ expect(new Int8Array([0, -1])).not.toEqual(new Uint8Array([0, 255]));
+ expect(new Float32Array([0])).not.toEqual(new Uint8Array([0, 0, 0, 0]));
+ });
+
test("deepEquals throw getters", () => {
let a = {
get x() {