From 5f42b1fc6bb9c8227ec57c1233893c401de1d9df Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 30 Nov 2019 16:02:37 -0800 Subject: [PATCH] test: assert: fix deepStrictEqual comparing a real array and fake array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/30743 Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso --- test/parallel/test-assert-deep.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 9d30f466f34928..fcc3765105f57c 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -1043,6 +1043,21 @@ assert.throws( assertDeepAndStrictEqual(a, b); } +// Verify that an array and the equivalent fake array object +// are correctly compared +{ + const a = [1, 2, 3]; + const o = { + __proto__: Array.prototype, + 0: 1, + 1: 2, + 2: 3, + length: 3, + }; + Object.defineProperty(o, 'length', { enumerable: false }); + assertNotDeepOrStrict(o, a); +} + // Verify that extra keys will be tested for when using fake arrays. { const a = {