Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: prohibit notDeepEqual usage #16325

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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