stack trace
looked into the stack trace issue, and what I think is that only filename and line number of entry two in the general stack trace are relevant to show
Sounds interesting, I'll take a look when I get chance. I'm a little worried about removing useful stacktrace info from test failures though.
I've been trying to think about the issue a lot, and following is my understanding of how it works, please correct me if I'm wrong:
- when
test.ok()etc. is called, the stack trace up to this point only contains nodeunit invocations, none of which are relevant to find the error in question. - the arguments to the test functions have returned when the test function are executed, thus any intresting stack trace are lost.
- the test function makes one extra call before it ends up at the AssertError handler (I'm not certain if this always is the truth, but it seems so)
I've not tested with exception assertions, though I don't think they will be included in the stack trace, as it would imply that the stack trace are merged at some point (which doesn't make any sense).
I have a slightly different approach in my self-contained branch. The inline reporter removes any lines that have 'nodeunit/' in them and also colorizes any line that belongs to the module being tested. Definitely much better signal-to-noise ratio.
Instead of removing stack traces entirely can we have an option to explicitly hide them? I'm doing test driven development, and so I have a gigantic suite of tests that fail. as I implement the code more tests start to pass, but its almost unusable iteratively because the stack traces dont mean anything and take up a huge amount of space in the output. The default option would of course be to NOT hide them, I'd be super happy with the option to enable this behavior, especially at the beginning of my projects where my tests are a big mountain of fail. :)
+1 @mreinstein — An option to hide stack traces would be fantastic.
(nodeunit rocks, keep up the good work!)
@caolan (or anyone) is this possible now? Seeing the entire stack trace on each test failure must be the most annoying thing about using Nodeunit. If I want to see the trace I should be able to enable it, no?
Assertion Message: No data available for this user.
AssertionError: 404 == 200
at Object.equal (/opt/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at Request._callback (/Users/XXX/XXX/Development/XXX/API-Testing/test.js:208:10)
at Request.self.callback (/Users/XXX/XXX/Development/XXX/API-Testing/node_modules/request/request.js:122:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (/Users/XXX/XXX/Development/XXX/API-Testing/node_modules/request/request.js:888:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/Users/XXX/XXX/Development/XXX/API-Testing/node_modules/request/request.js:839:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
In my case the first two lines are more than enough. Please let me know.
So, basically what @mreinstein said. +1 to that.
+1 to what @mreinstein said, an option to turn off stack traces would be nice
+1 to option @mreinstein