-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
how can I know which assertion failed ? #425
Comments
possible duplicate of #377 |
Hey @mderazon thanks for the issue. Mocha should present you with a stack trace of the error, including the line which threw the assertion error. Could you please paste the output of both your tests, and the failing log - and if it does not give you a stack trace I'll hopefully be able to point you as to why not. |
Thanks I actually do see that in some cases Mocha gives me a line number (greyed out below the assertion).
I get
But in other cases when I run for example the assertion
I simply get
|
@mderazon what happens if you set |
@keithamus it shows the stack! Is there any reason why this shouldn't be the default behaviour ? |
Honestly, I don't know. I'm sure there is a good reason. @logicalparadox may be able to tell you. |
I upgraded to chai 2.x and node v0.12.x and now I don't get stack traces anymore, even with |
@diversario what test runner are you using? What versions? Do you have some sample code? It might be better to file a new issue. |
@diversario: Which mocha version do you use? I figured out that I don’t get proper stack traces anymore for any version > 2.2.1 (thought it was Chai first, but it’s not). See mochajs/mocha#1736 |
That might be it; I upgraded to mocha 2.2.5. |
@diversario Try the |
Seems this has been resolved but let us know if otherwise. |
Hi guys, don't know if it's a Chai question / Mocha, but I am facing a very basic issue that I feel like i'm missing something.
Some of my tests have more than a few assertions and when some of them fail all I get is something like
AssertionError: expected true to be false
.Is there any way to know which assertion failed ? Line number / stack trace perhaps ?
I know I can add a text description to each assertion but I don't want to clutter my test files with unnecessary text just to mark which assertion failed when a line number would be sufficient.
Right now I am just commenting out assertion and re-running tests just to find the faulty one. I feel stupid when I do that...
Thanks 👍
The text was updated successfully, but these errors were encountered: