Skip to content

Commit

Permalink
tools: prohibit notDeepEqual usage
Browse files Browse the repository at this point in the history
PR-URL: #16325
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
BridgeAR authored and MylesBorins committed Dec 11, 2017
1 parent 4210e04 commit 3827840
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down
14 changes: 7 additions & 7 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ 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) {
if (isDeepEqual(actual, expected)) {
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) {
Expand Down

0 comments on commit 3827840

Please sign in to comment.