-
-
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 output discards assertion details #1065
Comments
I made an attempt to fix this issue via #949, which was rejected. How about this solution? Always print the assertion message, treat the diff as an extra, nice-to-have detail. expect('actual', 'surname').to.equal('expected');
/* result:
AssertionError: surname: expected 'actual' to equal 'expected'
actual expected
"expectedactual"
*/ I am willing to contribute a patch once the Mocha team decides on what is the acceptable way to fix this bug. |
I have updated the issue description to mention the missing stack trace. This is my new proposal:
@travisjeffery what's your opinion? |
Also would like to see this added to the core assert:
|
@SheetJSDev that's just another case of the same underlying problem. |
+1 @bajtos I just ran into this one as well.
|
closing as old |
@boneskull I believe the problem was still not fixed :( Are you willing to accept a pull request from me that would fix the issue? The issue is old because I was waiting for input from Mocha maintainers on what's the acceptable solution, since my initial attempt to fix this issue via #949 was rejected. |
This is still a pretty big problem (with the default reporter at least), especially when using the chai library. For something like this: expect(1).to.equal(2) But if you use a description (e.g. And it gets even worse when using This happens because chai sets the |
When a test failure is printed using the diff output, assertion details are discarded by mocha. This makes it more difficult to understand why the test failed without inspecting test source code. It is also inconsistent with the default (non-diff) algorithm.
Update
Another bit of information that is stripped from the output is the stack trace, as pointed out in the mailing list (link).
The text was updated successfully, but these errors were encountered: