From d1dabd8e41a827af2abfd7aec73895279a3f3c58 Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Thu, 20 Sep 2018 18:00:17 -0700 Subject: [PATCH] test: use a valid comparefn for sort According the the ES spec a valid comparefn returns a negative number, zero, or a positive number. The behavior of returning a boolean is also not consistent among JS engines. --- test/parallel/test-util-inspect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index cd7d08caf0a0f8..ab79bd45eb2801 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1688,7 +1688,7 @@ assert.strictEqual( assert.strictEqual( inspect( { a200: 4, a100: 1, a102: 3, a101: 2 }, - { sorted(a, b) { return a < b; } } + { sorted(a, b) { return a === b ? 0 : (a < b ? 1 : -1); } } ), '{ a200: 4, a102: 3, a101: 2, a100: 1 }' );