From 8e562c219253083c296c636be0ada5398c384554 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 19 Oct 2017 17:39:29 -0200 Subject: [PATCH] tools: prohibit notDeepEqual usage --- .eslintrc.yaml | 3 +++ lib/assert.js | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 738a4b605d2669..0f46a7fbfa77c7 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -56,6 +56,9 @@ rules: - object: assert property: deepEqual message: Use assert.deepStrictEqual(). + - object: assert + property: notDeepEqual + message: Use assert.notDeepStrictEqual(). - object: assert property: equal message: Use assert.strictEqual() rather than assert.equal(). diff --git a/lib/assert.js b/lib/assert.js index 304618fb3d4d26..1f506b7c7502bd 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -101,13 +101,6 @@ assert.deepEqual = function deepEqual(actual, expected, message) { innerFail(actual, expected, message, 'deepEqual', deepEqual); } }; -/* eslint-enable */ - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!isDeepStrictEqual(actual, expected)) { - innerFail(actual, expected, message, 'deepStrictEqual', deepStrictEqual); - } -}; // The non-equivalence assertion tests for any deep inequality. assert.notDeepEqual = function notDeepEqual(actual, expected, message) { @@ -115,6 +108,13 @@ assert.notDeepEqual = function notDeepEqual(actual, expected, message) { innerFail(actual, expected, message, 'notDeepEqual', notDeepEqual); } }; +/* eslint-enable */ + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!isDeepStrictEqual(actual, expected)) { + innerFail(actual, expected, message, 'deepStrictEqual', deepStrictEqual); + } +}; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) {