-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Diff is not generated for assert.deepEqual(obj, undefined, message) with non-empty message #3729
Comments
@Antonius-S So I believe this is a question for the Run as const assert = require('assert');
console.log('With message')
try {
assert.deepStrictEqual({ foo: "bar" }, undefined, 'msg');
} catch (e) {
console.log('message: ', e.message)
}
console.log('-----')
console.log('Without message')
try {
assert.deepStrictEqual({ foo: "bar" }, undefined);
} catch (e) {
console.log('message: ', e.message)
} Results:
Basically Mocha doesn't and shouldn't generate the diff, someone else does here tho. |
Well, you're partially right. Diff in your example is generated by Node and seems no printing diff with
Nevertheless, there's one incontinence. While bare |
So in this scenario it passes criteria for Mocha to generate its own diff. |
I will investigate further. |
The output is consistent and not the result of a bug. Node's diff:
As mentionned above Mocha's diff: Mocha supports various third party assertion libraries, each of them can differ in its diff logic. Mocha generates its own diff independently of the assertion library used. |
2 questions I still have |
If there is a message and acceptable expected/actual value, a diff will be generated by mocha.
|
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.Description
Steps to Reproduce
Expected behavior: Expect diff generated for all cases
Actual behavior: Diff not generated if
message
is non-emptyReproduces how often: always
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 6.0.0-1node --version
: v10.15.1Additional Information
The text was updated successfully, but these errors were encountered: