Skip to content

Commit

Permalink
tools: prohibit notDeepEqual usage
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Nov 23, 2017
1 parent 317f596 commit 8e562c2
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 8e562c2

Please sign in to comment.