nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

stack trace

Open azatoth opened this issue 14 years ago • 9 comments

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

azatoth avatar Mar 20 '11 22:03 azatoth

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.

caolan avatar Mar 21 '11 09:03 caolan

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).

azatoth avatar Mar 21 '11 19:03 azatoth

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.

mgutz avatar Aug 20 '11 20:08 mgutz

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. :)

mreinstein avatar Oct 24 '12 19:10 mreinstein

+1 @mreinstein — An option to hide stack traces would be fantastic.

(nodeunit rocks, keep up the good work!)

statico avatar Dec 02 '12 20:12 statico

@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.

Sneppers avatar Feb 22 '14 12:02 Sneppers

So, basically what @mreinstein said. +1 to that.

Sneppers avatar Feb 22 '14 12:02 Sneppers

+1 to what @mreinstein said, an option to turn off stack traces would be nice

caolan avatar Mar 28 '14 17:03 caolan

+1 to option @mreinstein

leachryanb avatar May 19 '14 21:05 leachryanb